Specify currency and locale while adding item to cart using Web API
-
How to specify currency when adding or removing item from cart using Web API. Currently it always returns prices in default currency
-
Hello @drimtim5390,
Can you elaborate more about your query...
-
Of course, according to the documentation, to add items to cart I should send following data via post request:
product_id
quantity
is_configurable
Currently, I have 2 locales and 2 currencies. When I use this API, response is adjusted to current locale I'm using. For example, if my current locale is EN, product names, description and others come to in EN. But the same is not happening for currencies.
Do I make myself clear? -
Hi @drimtim5390
Have you enabled both locale and currency in channel configuration?? otherwise, the default locale will show in response.
-
Yes I did. Locale and currency switchers in website are working properly.
-
Hello @drimtim5390
There is also API for switching locale and currency, use that API to switch this one.
Then selected currency will be used while adding product in cart.
-
@rahul I tried that too. It changes locale and currency in session and in a web page after reloading, but it doesn't change currency used for calculations in API. If possible, please, can you give a little explanation about these fields in response of cart object.