Heads Up, International Stores! A Quirky Discount Bug in Shopify's Cart API (CLP, VND, JPY & More)
Hey folks! As someone who spends a lot of time diving deep into Shopify’s nooks and crannies, especially around migrations and custom development, I often stumble upon fascinating (and sometimes frustrating!) discussions in the Shopify community forums. Recently, a thread caught my eye that’s super important for anyone running an international store, particularly if you deal with currencies that don’t use decimals.
It seems there’s been a bit of a head-scratcher with how Shopify’s /cart.js API handles discount values for what we call “zero-decimal currencies” like the Chilean Peso (CLP), Vietnamese Dong (VND), and Japanese Yen (JPY). Let’s break down what’s happening and what it means for your store.
The Curious Case of the Missing ‘Cents’ (or Rather, the Misplaced Scale!)
A sharp-eyed developer, duongnt.avadagroup, kicked off a detailed discussion highlighting a peculiar inconsistency in the /cart.js Ajax Cart API. If you’re building custom cart experiences, mini-carts, or integrating with other tools that pull real-time cart data, you’re probably familiar with this API.
Here’s the gist: for most currencies (like USD or EUR), all the money-related fields you get back from /cart.js – think price, total_discount, line_level_discount_allocations[].amount, and line_level_total_discount – all speak the same language. They’re all scaled consistently, usually in “cents-like” integer units (e.g., $10.00 is represented as 1000).
However, when your store’s primary currency is a zero-decimal currency, things get a little wonky. While most of those fields (price, total_discount, etc.) still maintain that “cents-like” scale, the line_level_total_discount field seems to be an outlier. It’s returned at a different scale – specifically, 100 times smaller than all the other related discount fields!
Let’s Look at a Real-World Example (Thanks, Community!)
duongnt.avadagroup provided an excellent concrete example using a store with CLP (Chilean Peso) as its currency. Imagine a product with a discount:
{
"currency": "CLP",
"items": [
{
"price": 1099000,
"original_price": 1099000,
"discounted_price": 989100,
"total_discount": 219800,
"discounts": [
{
"amount": 219800,
"title": "AOVAI_7EJ2U0P9"
}
],
"line_level_discount_allocations": [
{
"amount": 219800,
"discount_application": {
"title": "AOVAI_7EJ2U0P9",
"total_allocated_amount": 219800
}
}
],
"line_level_total_discount": 2198
}
]
}
If we interpret these values for CLP:
price: 1099000means CLP 10,990total_discount: 219800means CLP 2,198line_level_discount_allocations[0].amount: 219800also means CLP 2,198
But then we hit line_level_total_discount: 2198. See the problem? It’s 100 times smaller than total_discount and the sum of line_level_discount_allocations. This means if you’re just blindly using line_level_total_discount in your calculations or display, your discounts will appear drastically incorrect for your customers in these regions.
The developer also confirmed this exact behavior with VND (Vietnamese Dong) and JPY (Japanese Yen), suggesting it’s a systemic issue for zero-decimal currencies.

Why This Isn’t Just a ‘Feature’
As duongnt.avadagroup rightly points out, this isn’t likely an intentional feature. Shopify’s own documentation for the Ajax Cart API and theme discounts doesn’t mention any different scaling for line_level_total_discount in specific currencies. If it were a feature, you’d expect it to be clearly documented and, ideally, applied consistently across all currencies, not just zero-decimal ones. The current behavior makes it incredibly difficult for developers to write robust cart logic that works seamlessly across different international stores.
Interestingly, another community member, VRverse, had an earlier post in the thread suggesting the issue might be fixed when using {{amount_no_decimals}}. While that Liquid filter helps with displaying currency *without* decimals, it doesn’t address the underlying API data inconsistency. The core problem remains in the raw data returned by /cart.js, which affects custom calculations and integrations.

What Can You Do About It? (For Developers & Store Owners with Custom Setups)
While Shopify ideally needs to either fix this inconsistency or explicitly document it, if you’re a developer working with stores using these currencies, you can implement a workaround. This ensures your custom cart logic, apps, and display elements calculate discounts correctly.
Instructions for Developers:
When fetching data from /cart.js and dealing with line_level_total_discount, you’ll need to add a conditional check and adjustment:
Identify Zero-Decimal Currencies: First, you need to know if the store’s currency is one of the affected zero-decimal types (CLP, VND, JPY, KRW, etc.). You can get the currency from the
currencyfield in the/cart.jsresponse itself.Apply the ‘Divide by 100’ Correction: If the currency is a zero-decimal one, take the value of
line_level_total_discountand divide it by 100 to bring it in line with other discount fields.
Here’s a simplified example of how you might implement this in JavaScript, assuming you’ve already fetched the cart object:
const cart = /* Your /cart.js response object */;
const zeroDecimalCurrencies = ['CLP', 'VND', 'JPY', 'KRW']; // Add others as confirmed
cart.items.forEach(item => {
if (zeroDecimalCurrencies.includes(cart.currency)) {
// Apply the correction only if it’s a zero-decimal currency
item.line_level_total_discount = item.line_level_total_discount / 100;
}
// Now all your discount calculations for this item should be consistent
// For example, if you wanted total discount for the line item:
// const actualLineDiscount = item.line_level_total_discount;
// console.log(`Corrected Line Discount: ${actualLineDiscount}`);
});
// You can then proceed with your cart calculations and display logic
This ensures that your custom scripts and apps are correctly interpreting the discount values, preventing miscalculations and potential customer confusion.
Wrapping It Up
This kind of deep dive into API quirks is exactly why the Shopify community forums are so invaluable. It’s where developers can flag these inconsistencies and help each other find workarounds until official fixes or documentation updates are released. If you’re building a custom Shopify experience for an international audience, especially in regions using zero-decimal currencies, keep this line_level_total_discount nuance in mind. Double-check your calculations, and consider implementing the suggested correction. Let’s hope Shopify addresses this soon to make life easier for everyone building on their platform!