Home Forums Air WordPress Theme Automatically “update cart” after changing the quantity of the cart item

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #21510
    minarchitect
    Participant
    Purchased

    Hello Sea Theme,

    On the cart page. Is it possible to automatically “update cart” after changing the quantity of the product item, please?

    I’ve tried search google and put this code into functions.php, but don’t work for this kind of #QTY of the theme cart page. (I don’t know to code and don’t know that this code is correct or not)

    add_action( ‘wp_footer’, ‘bbloomer_cart_refresh_update_qty’ );

    function bbloomer_cart_refresh_update_qty() {
    if (is_cart()) {
    ?>
    <script type=”text/javascript”>
    var timeout;

    jQuery(‘div.woocommerce’).on(‘change’, ‘input.qty’, function(){ // keyup and mouseup for Firefox support
    if (timeout != undefined) clearTimeout(timeout); //cancel previously scheduled event
    if (jQuery(this).val() == ”) return; //qty empty, instead of removing item from cart, do nothing
    timeout = setTimeout(function() {
    jQuery(‘[name=”update_cart”]’).trigger(‘click’);
    }, 1000 ); // schedule update cart event with 1000 miliseconds delay
    });
    </script>
    <?php
    }
    }

    Could you please suggest to me about the code to automatically “update cart” when the quantity of cart item change.

    thank you

    Regards!
    Min

    #21514
    SeaTheme
    Keymaster
    Purchased

    Hi,

    I tested the code and tried to change several places, it doesn’t work. I don’t know where is wrong.
    It is not possible by the quick custom CSS codes.
    I am sorry, it’s not included in our Free Support scope.

    Regards!

    SeaTheme – SeaTheme.netTwitterFacebook

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Join Newsletter(FREE)

Subscribe to our newsletter to receive news & updates. We promise to not spam you, super promise!