Ajax

Hello Adrian.

The requests to admin ajax cannot be stopped, but it is possible to make the requests not be so constant and reduce the number of requests that are made.

/?wc-ajax=get_refreshed_fragments

WooCommerce calls ” /? wc-ajax = get_refreshed_fragments ” to update the cart items and cart total asynchronously, that is, without the need to refresh the page of the website you are visiting.

.- Accede to WooCommerce > Settings > Products > General

.- check the box «Redirect to cart page after successfully adding products» and deactivate the «Enable AJAX add to cart buttons in files».

.- Disable Ajax calls on the front page and posts by adding the following in the functions.php file that you will find in wp-content -> themes -> Your_template

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’); }

.- Disable WooCommerce Styles and Scripts by adding the following in the functions.php file

add_action( ‘wp_enqueue_scripts’, ‘dequeue_woocommerce_styles_scripts’, 99 ); function dequeue_woocommerce_styles_scripts() { if ( function_exists( ‘is_woocommerce’ ) ) { if ( ! is_woocommerce() && ! is_cart() &&! is_account_page() && ! is_checkout() ) { # Styles wp_dequeue_style( ‘woocommerce-general’ ); wp_dequeue_style( ‘woocommerce-layout’ ); wp_dequeue_style( ‘woocommerce-smallscreen’ ); wp_dequeue_style( ‘woocommerce_frontend_styles’ ); wp_dequeue_style( ‘woocommerce_fancybox_styles’ ); wp_dequeue_style( ‘woocommerce_chosen_styles’ ); wp_dequeue_style( ‘woocommerce_prettyPhoto_css’ ); # Scripts wp_dequeue_script( ‘wc_price_slider’ ); wp_dequeue_script( ‘wc-single-product’ ); wp_dequeue_script( ‘wc-add-to-cart’ ); wp_dequeue_script( ‘wc-cart-fragments’ ); wp_dequeue_script( ‘wc-checkout’ ); wp_dequeue_script( ‘wc-add-to-cart-variation’ ); wp_dequeue_script( ‘wc-single-product’ ); wp_dequeue_script( ‘wc-cart’ ); wp_dequeue_script( ‘wc-chosen’ ); wp_dequeue_script( ‘woocommerce’ ); wp_dequeue_script( ‘prettyPhoto’ ); wp_dequeue_script( ‘prettyPhoto-init’ ); wp_dequeue_script( ‘jquery-blockui’ ); wp_dequeue_script( ‘jquery-placeholder’ ); wp_dequeue_script( ‘fancybox’ ); wp_dequeue_script( ‘jqueryui’ ); } } }

Note: Before adding the code download a copy of the file to have the original

See also  Why stripe in woocommerce always charges me 2.9% and not 1.4...

wp-admin/admin-ajax.php?action=pys_get_gdpr_filters_values

This is from the plugin Pixel Your Site you can disable it from the plugin options:

Check if what I tell you improves the load.

All the best

AnswerQuote

Answered: 12/29/2021 11:40 am

Loading Facebook Comments ...
Loading Disqus Comments ...