Construct a discountCodeBasicCreate mutation with a DiscountCodeBasicInput that includes title, code, startsAt, endsAt, usageLimit, appliesOncePerCustomer, customerGets (value type and amount), customerSelection (all or specific segments), and minimumRequirement if needed
Set the value field inside customerGets to either a DiscountAmount (fixed) or DiscountPercentage; for fixed, specify amount and appliesOnEachItem to control whether the amount repeats per line
Handle the discountUserErrors array in the mutation response — common errors include code already taken, invalid date range, and invalid amount for the store currency
To add the code to an existing basic discount, use discountCodeBasicUpdate instead of creating a new discount node; a single discount can have multiple codes via discountRedeemCodeBulkAdd
Query the created discount node with discountCodes { nodes { code usageCount } } to confirm the code is active and the usage counter starts at zero
Test redemption via the Storefront API cartDiscountCodesUpdate mutation; verify the cart's discountCodes and discountAllocations reflect the applied amount
Known gotchas
discountCodeBasic is for code-based discounts; for automatic discounts use discountAutomaticBasicCreate — the mutation names differ and the input types are not interchangeable
The code string must be unique per shop and is case-insensitive in Shopify's matching logic but stored as provided; duplicates across case variants may confuse merchants
minimumRequirement subtypes are DiscountMinimumQuantity and DiscountMinimumSubtotal — you must provide exactly one, not both; omitting it means no minimum is enforced
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