How to handle the price on cart.json, it automatically multiple for 100 in random store

torus-peter
Shopify Partner
5 0 1

 

We got an issue that the price returns from cart.json api, it is multipled for 100 in random store.

orichipeter_1-1714991653424.png

orichipeter_2-1714991670416.png

Is there any option configured it on Shopify admin?

 

 

Replies 2 (2)

Atanu_Sarkar
Shopify Partner
10 3 3

Hi @torus-peter ,

 

Shopify always returns the price in cents, that is why it shows in multiples of 100, this behaviour can be noticed in liquid too.

 

For example,

if the price of a product is $100, and in liquid if you write {{ product.price }}, it will show as 10000, that is why we use a 'money' filter in liquid ({{ product.price | money }}), this will show the price with the currency and also show the price in dollar value.

For javascript you have replicate something like that as there are no functions available for this in shopify frontend, you have to divide the price by 100 for your calculation.

torus-peter
Shopify Partner
5 0 1

Hello @Atanu_Sarkar , As you see in my 2 images, there are some stores where the price doesn't multiply by 100. That is my concern.