A
A
anriko2019-12-26 11:28:42
WooCommerce
anriko, 2019-12-26 11:28:42

How to remove woocomerce mini cart from cache?

It didn’t work out, I can’t update these js from the console either, but it gives console.log('reset');
but not updated

add_action('wp_ajax_cart_count', 'custom_cart_count');
add_action('wp_ajax_nopriv_cart_count', 'custom_cart_count');
function custom_cart_count() {
    echo WC()->cart->cart_contents_count;
    wp_die();
}
add_action('wp_enqueue_scripts', 'custom_scripts');
function custom_scripts()
{
    wc_enqueue_js( "
        $.ajax({
            url: '".admin_url('admin-ajax.php')."',
            data: {
                'action': 'cart_count'
            },
            success: function(resp) {
              console.log('сброс');
              console.log(resp);
            }
        });
    ");
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question