D
D
dimas75252018-12-14 11:46:07
WordPress
dimas7525, 2018-12-14 11:46:07

Is it possible to auto-update the cart when you click on + -?

How can I make the cart auto-update when you click on + - following the example of the site: delikateska .ru/product/6253?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
Jupiter Max, 2018-12-14
@vardoLP

it's just a cost-to-quantity conversion. Cart is not updated. For example

I
id_dmitriy, 2018-12-14
@baton4eg

Like this. Put your classes there to make it work.

//Увеличить кол-во товаров на +1 из карточки
    $(document).on("click", '.qty_plus', function() {
        var $cur_val = $(this).closest('.qty_wrapper').find("input.qty").val();
        $(this).closest('.qty_wrapper').find("input.qty").val( parseInt($cur_val) + 1 );
        cart_update();
    });
    //Уменьшить кол-во товаров на -1 из карточки
    $(document).on("click", '.qty_minus', function() {
        console.log('-');
        var $cur_val = $(this).closest('.qty_wrapper ').find("input.qty").val();
        if($cur_val > 1) {
            $(this).closest('.qty_wrapper').find("input.qty").val( parseInt($cur_val) - 1 );
            cart_update();
        }
    });

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question