WooCommerce is undoubtedly one of the most used WordPress plugins, and it allows you to set up an online store quickly and easily, turning WordPress into a complete ecommerce just by installing it.
For many of its features, WooCommerce uses Ajax to make the shopping experience more enjoyable and one of the processes, the so-called “wc-ajax=get_refreshed_fragments” caused by cart fragments, is the one that can make it slow , and why you may have landed here.
In this note we are going to tell you how to fix WooCommerce slowness due to the “wc-ajax=get_refreshed_fragments” process along with a little information about what it is about.
What is the WooCommerce wc-ajax=get_refreshed_fragments process
This process is nothing more than an Ajax call that WooCommerce makes to retrieve data from the shopping cart, something that ends up increasing the loading time for a long time, and even more so if it is a site that has many visits, does not have adequate web hosting. , or you are in the middle of an ecommerce event. This is more accentuated if the website is not optimized or if you are using shared hosting to host your store.
WooCommerce calls the “wc-ajax=get_refreshed_fragments” function to update the cart items, display the latest additions, and the total whether or not the current page is reloaded, or the shopper is browsing the store. AND
Admin Ajax calls and page loading
As you already know, Ajax allows you to update a fragment of a page on your website without having to refresh the entire page in the browser. What happens in this particular case is that calls to “admin-ajax.php” every so often delay page loading times considerably, in addition to consuming more server resources than normal.
The other problem is that WooCommerce does this on every page turn, even though there is no cart or product details. Due to this, the loading of all pages on your website slows down, even if they have nothing related to the online store.
So there is no point in removing the cart from a specific page or entry. Loading times will continue just as bad. The ideal thing to do is to disable the permanent cart update.
With WNPower it’s easier. To detect if what is actually slowing down your WooCommerce is the “wc-ajax=get_refreshed_fragments” process, you can use our Consumption Monitoring tool.
When entering the process details, if you found some of these two running, or both, or more than one of each of them, you hit the mark: they are the probable cause of the slowness.
- wc-ajax=get_refreshed_fragments
- wc-ajax=update_order_review
How to fix WooCommerce slowness caused by wc-ajax=get_refreshed_fragments
Let’s see how to solve the overhead that this Ajax call adds to your WooCommerce and makes it slow. The two alternatives are to install a plugin to disable cart fragments, and the other, of course, for more advanced users: to insert some code between the WordPress php.
How to disable WooCommerce cart fragments with a plugin
The easiest way to fix WooCommerce slowness due to “wc-ajax=get_refreshed_fragments” is by installing the Disable Cart Fragments by Optimocha plugin. Otherwise, you’d have to reach under the hood of WordPress, which could become a little more awkward.
The great thing about this plugin is that once installed, it makes all the necessary settings and does not require anything more than installing it and activating it from your wp-admin panel.
How to disable WooCommerce cart fragments by adding code
If you are an advanced WordPress user, then you can try to solve the issue by adding source code. What you have to do first is open to edit the functions.php file with the cPanel File Manager, from the secure terminal or with your favorite code editor, and paste this script:
/** Desactivar llamadas a cart fragmentes*/ add_action( ‘wp_enqueue_scripts’, ‘dequeue_woocommerce_cart_fragments’, 11); function dequeue_woocommerce_cart_fragments() { if (is_front_page() || is_single() ) wp_dequeue_script(‘wc-cart-fragments’); }