Disable ajax reload in cart page

i have some custom coding which is creating trouble with woocommerce cart page ajax function, i want disable ajax on cart page so that page reload on updating/removing product from cart page, i have disable from woocommerce setting but its not efective on cart page

target remove button class with jquery and force to reload page but due ajax enable on cart page its not working, items does remove

$(document).ready(function () {
            $(" .remove").click(function () {
                location.reload(true);
                
            });
        });

where class remove is cart page red remove button
56
i wnat disable ajax on this cart page so page reload on remove/update

See if this helps :slight_smile: It should auto detect the url in your button’s href value

$(document).ready(function() {
	$(document).on('click', '.remove', function(e) {
		e.preventDefault(); // Prevent the default AJAX call
		var url = $(this).attr('href'); // Get the URL for the remove action
		window.location.href = url; // Redirect to the URL to perform the remove action and reload the page
	});
});

but you have to make sure you update woo’s funciton file:

function custom_disable_ajax_cart() {
	wp_enqueue_script('custom-disable-ajax-cart', get_template_directory_uri() . '/js/custom-disable-ajax-cart.js', array('jquery'), null, true);
}
add_action('wp_enqueue_scripts', 'custom_disable_ajax_cart');
1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.