Editing orders brings Shopify-calculated duties down

We have encountered an issue with duty calculations when editing orders through the Shopify Order Editing API, specifically when using the actions to remove a duty-bearing line item and then add the same variant back. When this sequence happens, Shopify sometimes recalculates a lower customs (dutiable) value than what was used during the initial checkout. As a result, both the calculated import duty and the total cost of the order go down, despite no discounts being applied—the `currentTotalDiscountsSet` remains at zero throughout the whole process.

To give a specific example, the product in question is an apparel item (HS code 6203420736) originating from China. The total import duty rate applied is 34.1%, made up of multiple surcharges and tariffs.

To reproduce the issue: first, place an order for this product and proceed through checkout. Then, edit the order through the API by removing the line item and adding the exact same variant back, finally committing the changes. After completing these steps, compare the new import duty amount and the order total to their original values.

What we observe is that, after the above API edits, the import duty drops from $29.11 to $26.52, and the base value used for customs calculations (the “dutiable base”) falls from roughly $85.37 to $77.76. Shipping and order totals also decrease slightly, while taxes on the order actually increase. Other values like discounts and authorized total remain unchanged.

Looking closer, all relevant product attributes such as duty rate, HS code, and country of origin stay the same. The only change is this revised dutiable value, which is being calculated differently when the item is re-added via the editing API. Specifically, it appears that Shopify re-extracts duty from a duty-inclusive price, ending up with a lower base for the calculation compared to checkout. As a result, the same product can end up with a different customs value simply depending on whether it’s added via checkout or through subsequent order edits.

For completeness, we have verified that shipping costs are not included in the duty base calculation in either the checkout or the editing API scenarios. If shipping were included, we would expect the duty amount to increase, not decrease.

One final detail: in Shopify’s internal ledger, the duty for the re-added line is still recorded as the original $29.11, matching the amount at checkout. However, both the order’s current duty field and what’s shown in the Admin interface reflect the lower $26.52 amount. This mismatch between the ledger and the actual order money fields could point to a second, related inconsistency.

Hey @keiraarts - I had a look into this for you and your understanding is basically right.

When you edit an order, Shopify doesn’t reuse the values calculated at checkout. Removing and re-adding a line item recalculates that line’s money fresh, including taxes and duties, so the dutiable base and duty can shift even when the HS code, country of origin, and rate are all unchanged.

On a duties-inclusive setup the per-unit price already has duty baked in, so the dutiable base is derived by backing duty out of that inclusive price. A recalculation on edit can land on a slightly different base than checkout did, which fits what you’re seeing (duty $29.11 down to $26.52, base shifting down, tax moving up). Worth confirming dutiesIncluded and taxesIncluded on the order to be sure that’s the pricing model in play. The recalculated duty only materializes once you call orderEditCommit, not in the staged calculatedOrder, which is why it surfaces after the commit. One small thing on the mechanics: there’s no orderEditRemoveLineItem mutation, removals go through orderEditSetQuantity set to 0, so if you’re doing a remove + re-add it’s that plus orderEditAddVariant.

The part that stands out is the mismatch you described, where the sales record still shows the original $29.11 but the order’s duty field reads $26.52. That’s the piece I’d want to dig into, since the two shouldn’t disagree. You can see both via the API and compare them directly: order.currentTotalDutiesSet (and LineItem.duties { price }) against the duty entry under order.agreements sales. If those genuinely diverge on the same committed order, that’s something to investigate further rather than expected behavior.

If you can grab the x-request-id from the orderEditCommit response header for one affected commit, that’s all I need. It’ll let me pull the logs for that exact call and trace where the recalculated base is coming from. Thanks!

Would you mind if I email you the order_id/merchant?

Hi @keiraarts, I don’t get to check the forums as often as I’d like so I appreciate the patience!

For anything more urgent I’d recommend starting a chat with Partner Support and our Developer Support team will be happy to take a closer look

I’ll send you a DM to request the details here on the forum, and follow up here in-thread with my findings in case they might be useful to anyone else - cheers!