If your site is slow and you have WooCommerce installed, chances are, it is caused by “/?wc-ajax=get_refreshed_fragments” which refers to WooCommerce Ajax Cart Fragments.
What is WooCommerce Ajax Cart Fragments?
Before going into Ajax Cart Fragments, we need to understand what is AJAX and AJAX Add To Cart.
AJAX = Asynchronous JavaScript And XML. This allows the website to run functions without refreshing the website.
AJAX Add To Cart = Allows adding an item to cart by running a function in the background without refreshing the website.
WooCommerce Ajax Cart Fragments is a feature implemented by WooCommerce to run on all pages including non-WooCommerce pages such as blog posts to get shopping cart details so that it is always ready to accept updates to the shopping cart. Though this is a useful feature, it can be a resource intensive task and cause performance impact on simple sites with little resources assigned to it.
Before removing the WooCommerce Ajax Cart Fragments, take into account the following scenarios:
Does your site load the shopping cart on every page?
Do you need a real-time update of the shopping cart details throughout your page?
If you need a real-time update of your cart details, you may consider disabling the Ajax Cart Fragments ONLY on the pages that do not need to update the shopping cart such as About, Contact and blog pages.
How to disable WooCommerce Ajax Cart Fragments?
By Plugin
Simply install below plugin to your site and you are good to go.
https://wordpress.org/plugins/disable-cart-fragments
By modifying theme file
Login to your WP-Admin
Go to Appearance > Editor
Locate the functions.php file
Add the following code to the end of the file.
/** Disable Ajax Call from WooCommerce */
add_action( 'wp_enqueue_scripts', 'dequeue_woocommerce_cart_fragments', 11);
function dequeue_woocommerce_cart_fragments() { if (is_front_page()) wp_dequeue_script('wc-cart-fragments'); }
Once the Ajax Cart Fragments is disabled, go to WooCommerce > Settings and enable the option “Redirect to the cart page after successful addition”