Menu
discountRedeemCodeBulkAdd
Asynchronously add discount codes in bulk that customers can use to redeem a discount. You can use the discountRedeemCodeBulkAdd mutation to automate the distribution of discount codes through emails or other…
Use it in a workflow
- Add a step and choose the Shopify connector.
- Pick the discountRedeemCodeBulkAdd action (under Discount).
- Fill in the fields below, then reference the result from later steps as
{{discountredeemcodebulkadd.response.data}}.
Query
This is the mutation the action sends by default. Edit it in the step's Query field to change which fields come back.
mutation DiscountRedeemCodeBulkAdd($discountId: ID!, $codes: [DiscountRedeemCodeInput!]!) {
discountRedeemCodeBulkAdd(discountId: $discountId, codes: $codes) {
bulkCreation {
codesCount
createdAt
discountCode {
codeDiscount
id
}
done
failedCount
id
importedCount
}
userErrors {
code
extraInfo
field
message
}
}
}
Variables
Pass these as a JSON object in the step's Variables field.
{
"discountId": "string",
"codes": [
{
"code": "string"
}
]
}
Response
Read the result with {{discountredeemcodebulkadd.response.data.data.discountRedeemCodeBulkAdd}}. If the API returns errors, the step fails and they are at {{discountredeemcodebulkadd.response.data.errors}}.
Need more? See the Shopify guide for connection setup and behaviour shared by every action.
Was this page helpful?