A
A
Andrey Kotosin2019-04-20 20:17:19
opencart
Andrey Kotosin, 2019-04-20 20:17:19

How can I find out the price of an item when adding it to the cart?

The bottom line is that when you add a product to the cart (opencart 3), you need to find out the price of this product.
In JS, in the add() function, after adding, only the response json['total'] is received - where the final information about the goods in the basket and the cost is indicated. And I need to know the price of the product at the time of adding.
For example, there is an item Apple. It costs 15 rubles.
I press the add button and in response (for example, to the console) I want to display 15 (the cost of the product), unfortunately I can’t figure out how to do it. and its cost when added to the cart (in the products array, I can easily get the id, but I can’t get the price)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
zoozag, 2019-04-22
@zoozag

In JS, in the add() function, after adding, only the response json['total'] comes

ControllerCheckoutCart -> add()
Add any necessary data about the added product to json there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question