Ajax API's cart.js response contains wrong price to me

Solved
Benjamin22
New Member
3 0 0

Hello, I'm new at developing Shopify Apps.

I'm doing some stuff to interact with JavaScript at cart page.

I sent AJAX GET request to get items in current cart. (https://shopify.dev/docs/themes/ajax-api/reference/cart)

And then I got response with JSON from cart.js.

 

But, each price of items seems wrong.

Because, the store has product called "product_A". And its price is "8900.00".

But, I got price as "890000" from cart.js response. All prices of items have 2 more digits than an original one.

e.g. "3500" --> "350000"

 

I think It is a bug occurred while replacing decimal point of price.

Should I use the other API? or any suggestions?

or maybe a store settings problem?

Thank you.

 

 

0 Likes
Benjamin22
New Member
3 0 0

[UPDATE]

I'm not sure if It will be helpful to you to solve my problem.

Anyway, currency code is KRW.

0 Likes
AakashInfoTech
Shopify Partner
95 12 15

This is an accepted solution.

Hey ,

That is not the issue that is the default value of price.
Now you need to formate the price in the store Money formate.

Like this - Shopify.formatMoney( price )  

If this generates "Shopify.formatmoney is not a function " error in console. Then you need to include this {{ 'api.jquery.js' | shopify_asset_url | script_tag }} above your js 

 

0 Likes