Unexpected Behaviour in `cart.cost.totalAmount` Calculation Using Storefront API

Hi everyone,

I’m encountering an issue while using the Storefront API to generate carts, and I’d appreciate any insights from the community.

Here’s the scenario I’ve observed a few times:

  • The price of an item is, say, $10.
  • cart.cost.subtotalAmount correctly shows $10.
  • cart.cost.totalTaxAmount shows some tax amount, e.g., $2.
  • However, cart.cost.totalAmount is not the sum of subtotalAmount and totalTaxAmount. For example, instead of $12, I’ve seen totalAmount be something higher, such as $15.

My expectation is that cart.cost.totalAmount would be the sum of cart.cost.subtotalAmount and cart.cost.totalTaxAmount. This discrepancy suggests that there’s an additional fee or adjustment coming into play, but I can’t find any reference to it in the cart data returned by the API.

My question:
Are there any other factors or components (e.g., shipping fees, additional adjustments, discounts, or Shopify app fees) that might contribute to cart.cost.totalAmount? If so, where should I look in the API response or settings to identify these moving parts?

Any guidance on understanding this calculation or troubleshooting these cases would be greatly appreciated!

Thanks in advance for your help!