Shopify themes, liquid, logos, and UX
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.
Solved! Go to the solution
This is an accepted solution.
Hey Benjamin22,
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
[UPDATE]
I'm not sure if It will be helpful to you to solve my problem.
Anyway, currency code is KRW.
This is an accepted solution.
Hey Benjamin22,
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
Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024Digital marketers and app developers have tracked activity in apps and websites for yea...
By Ollie Mar 13, 2024February was an exciting month with Shopify Editions, informative webinars, and more! F...
By JasonH Mar 7, 2024