M
M
Marat Agatov2021-01-27 18:07:24
JavaScript
Marat Agatov, 2021-01-27 18:07:24

Does the amount in the cart change depending on the quantity of the product?

60118131b72c5455695514.png
The product has a price, it needs to be multiplied by the quantity of the product and output how can this be implemented in minishop2?
Don't know how to implement it?
so that when the quantity of goods changes, the amount also changes.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Igor, 2021-02-04
@Orange-rus

If the minishop is the latest version, then just wrap the cost in
<span class="ms2_cost">270</span>
If not. the simplest via js:

miniShop2.Callbacks.add('Cart.change.response.success', 'cart_change_ok', function() {
  // проходишься по каждой строке товара и умножаешь цену на кол-во
  $( "li" ).each(function( index ) {
    console.log( index + ": " + $( this ).text() );
  });
})

L
Lukmann, 2021-01-27
@Lukmann

It will depend on how you implemented the logic of the online store, do you use only js or do you use php as well? in short, it
takes the value of the input, turns it into a number and multiplies by the price, depending on how you implemented the logic of the online store

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question