Shopify Functions in 2026: One Discount API Across Product, Order, and Shipping
Shopify Functions let you customize Shopify's backend logic at checkout — discounts, validations, delivery, and payment — without injecting scripts into checkout.liquid (which is gone). The current Discount Function API (2026-07) is the one we ship for brands that need rules the admin UI cannot express.
What changed
Older Function APIs split product, order, and shipping discounts into separate targets. The unified Discount Function API processes one discount (code-based or automatic) and can apply savings across three classes at once: product, order, and shipping. One function can reduce both the order total and delivery cost in a single pass.
Shopify documents a hard cap: you can activate a maximum of 25 discount functions per store. They run concurrently and have no knowledge of each other. Combination still follows the stacking rules on the discount node.
Use cases we implement
- Exclusions — skip engraved, wholesale, or gift-card lines.
- Tiered discounts when the cart hits item, subtotal, or delivery thresholds.
- SKU-targeted percentages stored in an app-owned metafield (the official SKU example on shopify.dev).
How we build it
The function reads cart.lines and discountNode.metafield via a GraphQL input query, then returns candidate operations. Configuration lives in an app metafield so merchants can change SKUs and percentages without a redeploy. We still compile and deploy through Shopify CLI as a Function extension — Rust or JavaScript — targeting the checkout Function target.
Source: Discount Function API (2026-07) and the SKU discount example.
Comments (0)
No comments have been posted yet. Be the first!