WooCommerce Mini Cart Not Update – Change the “No products in the cart” message
Today, while I was trying to improve the site speed of one of my clients, I found a cache issue. The site was actually an WooCommerce store and I was also using WP Rocket in the performance optimization process.
The issue was the mini cart button from the header wasn’t updated in the right language. What my client was seeking was to change the “No products in the cart” with a translated version of it in the Romanian language (Niciun produs in cos ).
For the translating task, I used Loco Translate, one of the best plugins from the market. The phrase was translated inside the Loco plugin, but – somehow – it didn’t refreshed in the front page of the store, and the mini cart button phrase wasn’t cleared properly (and updated with the right one).
Solving the Mini Cart Change Text Issue
The first thought was to clean the cache of WP Rocket plugin and also the browser cache, hoping this will solve the cache issue. But nothing… I started to investigate further and I began to disable the plugins. The first plugin I disabled was WP Rocket (knowing that any cache plugin may generate this kind of issues). With the WP Rocket disabled, the WooCommerce mini cart button updated with the right translated phrase. This is a general definition of this WooCommerce & WP Rocket issue:
"Cart issues can be related to WP Rocket's optimization of the get_refreshed_fragments request from WooCommerce."
BEFORE ANYTHING, DO A FULL BACKUP OF YOUR SITE.
The FIX: WooCommerce Refresh Cart Fragments
The solving action for fixing the mini cart cache issue is to remove the transient data. You can do this with the following two plugins:
1. Download this plugin from GitHub: WP Rocket | Deactivate WooCommerce Refresh Cart Fragments Cache , install and activate it. It will solve the issue.
2. If, from any other reasons, the mini cart don’t update, download this plugin: Transients manager plugin
After you activated the plugin, remove the following transient (you will see the entire list there):
That’s it. Now you solved the issue.