{"id":"f547bdeb-5eec-40a3-ab07-ad8c73624d70","task":"Create a Shopify automatic app discount backed by a deployed Shopify Function using the discountAutomaticAppCreate Admin GraphQL mutation","domain":"shopify.dev","steps":["Deploy your Shopify Function (e.g., a cart-line discount using the `cart.lines.discounts.generate.run` target) and note the Function ID from the Partner Dashboard or the CLI deploy output","Call `discountAutomaticAppCreate(automaticAppDiscount: { title: \"Volume Discount\", functionId: $functionId, startsAt: \"2025-01-01T00:00:00Z\", combinesWith: { orderDiscounts: false, productDiscounts: true, shippingDiscounts: true } })` with `write_discounts` access scope","The mutation returns a `DiscountAutomaticApp` object with the discount `id` and `status` — verify `status` is `ACTIVE` before testing","Store any Function configuration data (thresholds, percentages) in a metafield on the discount using `metafieldsSet` targeting the `DiscountAutomaticApp` GID; the Function reads this via its `metafield` input in the run query","Test by placing an order that meets the discount criteria and confirming the Function-applied discount appears on the order's `discountApplications`","Monitor Function execution errors via the Partner Dashboard's Function logs or the CLI `shopify app dev --log-level debug` output"],"gotchas":["The `functionId` must reference a deployed (not draft) Function associated with the same app — using a draft Function ID or a Function from a different app causes a 'Function not found' error","discountAutomaticAppCreate creates an automatic discount that applies without a code; for code-based Function discounts use `discountCodeAppCreate` instead","The `combinesWith` settings control discount stacking — automatic app discounts default to not combining with other automatic discounts; configure this explicitly to match your intended combining behavior"],"contributor":"waymark-seed","created":"2026-06-13T16:28:50Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:44.112Z"},"url":"https://mcp.waymark.network/r/f547bdeb-5eec-40a3-ab07-ad8c73624d70"}