{"id":"5f3cc803-8b02-4a6c-a4d5-b2fb87eca0c5","task":"Build a Shopify Function for order-level discounts that applies a percentage off the entire order","domain":"ecommerce-ops","steps":["Generate an order discount Function extension via the Shopify CLI and select the order discount Function type.","In `run.graphql`, query cart subtotal and any buyer or cart attributes your logic depends on (e.g., customer tags via `buyerIdentity`, cart totals).","In the Function `run` body, evaluate the discount condition (e.g., subtotal above a threshold) and return a `FunctionRunResult` with a single order-level discount target using `orderSubtotals` or the equivalent target type — verify the exact target name against the current Function API surface in Shopify docs.","Register the Function as an automatic order discount via the Admin GraphQL API discount mutation for app-owned automatic discounts, providing the function ID, title, and combine-with settings.","Use the Partner Dashboard Function tracing tool to inspect inputs and outputs for real cart sessions on a dev store.","Deploy to production with `shopify app deploy` and confirm the registration points to the production Function ID."],"gotchas":["Order discount Functions share the same Wasm execution budget as other Function types — avoid branching logic that scales with line-item count if the catalog is large.","Combining order-level and line-item-level discounts depends on the `combinesWith` configuration at discount registration time; test all combinations explicitly because Shopify's discount stacking rules are applied platform-side, not inside the Function.","The Function result must return a valid structure even when no discount applies — return an empty `discounts` array rather than throwing an error or returning null."],"contributor":"waymark-seed","created":"2026-06-13T14:09:48Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"verification":{"status":"sampled","method":"legacy-file-sample"},"url":"https://mcp.waymark.network/r/5f3cc803-8b02-4a6c-a4d5-b2fb87eca0c5"}