Scaffold a new Shopify Function with `shopify app function create`, choosing the product-discounts or order-discounts function type depending on target scope
Edit the function's input query (run.graphql) to request only the cart lines, merchandise IDs, prices, and buyer identity fields your logic needs — unused fields slow compilation
Implement the run function in Rust or JavaScript: read input.cart, sum line prices, and return a FunctionRunResult with an orderSubtotal FixedAmount or percentage PercentageValue discount
Test locally with `shopify app function run` passing a sample JSON input; check the output JSON matches the FunctionRunResult schema before deploying
Deploy with `shopify app deploy`, then create a corresponding DiscountNode (via Admin GraphQL discountAutomaticAppCreate) referencing the function's ID and configure the spend threshold as metafield configuration
Known gotchas
Shopify Functions have a strict execution time budget (under a few milliseconds); avoid network calls or heavy computation inside the function — all needed data must come through the input query
The metafield namespace for function configuration must match the namespace declared in the function's shopify.extension.toml; a mismatch causes the discount to silently apply no reduction
Automatic discounts created via discountAutomaticAppCreate are not stackable with other automatic discounts by default; test discount combination behavior explicitly in a development store
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp