Hi Shopify Devs & Partners,
I’m an engineer with experience building Shopify Functions and Checkout UI Extensions, and I’m running into a hard limitation with dynamic surcharges at checkout.
Business Logic:
- Apply a 30% tariff surcharge to all products with SKUs containing “DFCTO” in the cart.
- Only apply the surcharge if:
- The shipping country is the US.
- The product is not bundled with a ring setting (custom logic based on custom attributes).
- The surcharge must be dynamic (30% of the affected product(s) price), not a fixed fee.
What I’ve Tried:
- Shopify Discount Functions: Only support positive values (discounts), which reduce the order total. Negative values (for surcharges) are not supported and will be ignored or treated as zero.
- Cart Transform Functions: Can only decrease the price of cart lines (i.e., apply a discount), not increase it or add a fee.
Haven’t Tried:
- Checkout UI Extensions: Can add/remove products/variants to the cart using
useApplyCartLinesChange
, but cannot dynamically set the price of a product/variant at checkout. The price must be set in the Shopify Admin. - Hidden Product Workaround: Not scalable for thousands of products with different prices, as you’d need a variant for every possible fee amount.
- Third-party apps: Advanced Shipping Rules and Shipping Rates Calculator Plus can handle some country-specific surcharges, but not a true dynamic, per-product tariff as a line item.
What I Need:
- A scalable, native way to add a dynamic, percentage-based fee or surcharge to the order total for arbitrary products at checkout.
Questions:
- Is there any new pattern, API, or workaround for this use case?
- Are there any roadmap updates for supporting dynamic surcharges or fees at checkout?
- Has anyone built a production-ready workaround for this scenario?