Optimize WooCommerce get refreshed fragments
WP Rocket optimizes the get_refreshed_fragments AJAX request generated by WooCommerce to dynamically update the content of the cart.
What you will see
If you use WooCommerce and run speed tests on your site, you will be accustomed to seeing this long request in the waterfall chart:
http://www.example.com/?wc-ajax=get_refreshed_fragments
Even if WooCommerce uses LocalStorage to serve the cart content after the first visit, Pingdom or GTmetrix will call the request each time a new test is launched, since its bots act like a new visitor each time.
With WP Rocket caching this AJAX request, the time to display the cart content for the first visit (or when visitors navigate from a browser not supporting LocalStorage) will dramatically improve.
How does it work?
WP Rocket will automatically detect when a request contains
GET[‘wc-ajax’] = get_refreshed_fragments
And will check that the WooCommerce cart is empty, to avoid any issues with the content of the cart .
If the cart condition is respected, we will save the request content into a transient, which will be returned the next time the same request will be executed.
Deactivate WooCommerce get refreshed fragments cache
If you need to deactivate cache for WooCommerce Refresh Fragments, you can use the following helper plugin:
📥 Download (.zip): WP Rocket | Deactivate WooCommerce Refresh Cart Fragments Cache
Developers: you can find the code for this plugin on GitHub.
If, on the other hand, you want to fully remove this AJAX request, we recommend this method.