Clarification on cart.js money values (minor vs major units) and decimal places per currency

I’m building a loyalty app that uses the Ajax Cart API (/cart.js) from a theme app extension to simulate how many points a customer can earn on their current cart.

From /cart.js I’m reading values like:

json

Copy

{

“total_price”: 2925,

“total_discount”: 474,

“items”: [

{

“final_line_price”: 900,

“price”: 900,

  // ...

}

],

“currency”: “INR” // or EUR, JPY, etc.

}

Questions:

  1. Data format: Can you confirm that total_price, total_discount, price, final_line_price, etc. are always returned as integers in the smallest currency unit (minor units), regardless of the currency (INR, EUR, JPY, etc.)?

  2. Decimals per currency: Is there an official way (or documented list) to know how many decimal places each currency uses (e.g. INR/EUR = 2, JPY = 0, KWD = 3), so that we can correctly convert from minor units to major units in a multi‑currency app? Or should we maintain our own ISO 4217 decimals table?

  3. Exact amounts as shown in UI: Is there any Ajax API field or helper that returns the major‑unit amount (e.g. 29.25) or already formatted money value (same as what {{ cart.total_price | money }} shows in Liquid)?
    Or is the recommended approach to:

    • Use total_price (minor units) + currency,

    • And handle the division/formatting ourselves (e.g. using 10^decimals and Intl.NumberFormat)?

Right now we’re doing total_price / 100 to get a decimal amount for our external loyalty API, but we realized this hard‑codes “2 decimal places” and might be wrong for currencies like JPY or KWD. We’d like to follow Shopify’s recommended / supported way for multi‑currency apps.

Hey again @Ammaar_Farhan_Syed :waving_hand: Just confirming that you are correct here, the values from /cart.js like total_price and total_discount are returned as integers in the smallest currency unit (minor units), which you can see in the response examples in the Cart API reference here: Cart API reference

One important thing to note though is that Shopify normalizes all monetary values to 2 decimal places internally, even for zero-decimal currencies like JPY and KRW. From the order object docs ( Liquid objects: order ): “For currencies without subunits, such as JPY and KRW, tenths and hundredths of a unit are appended. For example, 1000 Japanese yen is output as 100000.” So dividing by 100 should give you the correct numerical value across currencies in Shopify’s system.

As for decimal places per currency, Shopify doesn’t expose that anywhere in the AJAX API (but it is surface-able in the Admin API and in some parts of Liquid, like the order object). The Liquid currency object ( Liquid objects: currency ) only gives you iso_code, name, and symbol. You’d need an external ISO 4217 library for display formatting (e.g., knowing JPY gets 0 decimals vs USD gets 2). No Ajax API endpoint returns formatted or major-unit values either, but you could grab the shop’s money_format setting from Liquid and use that as a template in your JS for client-side formatting.

Hope this helps! Let me know if I can clarify anything on our end here.