Menu
discountAutomaticAppCreate
Creates an automatic discount that's managed by an app. Use this mutation with Shopify Functions when you need advanced, custom, or dynamic discount capabilities that aren't supported by Shopify's native discount types.
Use it in a workflow
- Add a step and choose the Shopify connector.
- Pick the discountAutomaticAppCreate action (under Discount).
- Fill in the fields below, then reference the result from later steps as
{{discountautomaticappcreate.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 DiscountAutomaticAppCreate($automaticAppDiscount: DiscountAutomaticAppInput!) {
discountAutomaticAppCreate(automaticAppDiscount: $automaticAppDiscount) {
automaticAppDiscount {
appDiscountType {
app
appBridge
appKey
description
discountClass
discountClasses
functionId
targetType
title
}
appliesOnOneTimePurchase
appliesOnSubscription
asyncUsageCount
combinesWith {
orderDiscounts
productDiscounts
productDiscountsWithTagsOnSameCartLine
shippingDiscounts
}
context
createdAt
discountClass
discountClasses
discountId
endsAt
errorHistory {
errorsFirstOccurredAt
firstOccurredAt
hasBeenSharedSinceLastError
hasSharedRecentErrors
}
recurringCycleLimit
startsAt
status
tags
title
updatedAt
}
userErrors {
code
extraInfo
field
message
}
}
}
Variables
Pass these as a JSON object in the step's Variables field.
{
"automaticAppDiscount": {
"combinesWith": {
"productDiscounts": false,
"orderDiscounts": false,
"shippingDiscounts": false,
"productDiscountsWithTagsOnSameCartLine": {
"add": "string",
"remove": "string"
}
},
"discountClasses": [
"PRODUCT"
],
"title": "string",
"startsAt": "string",
"endsAt": "string",
"context": {
"all": "ALL",
"customers": {
"add": "string",
"remove": "string"
},
"customerSegments": {
"add": "string",
"remove": "string"
},
"markets": {
"add": "string",
"remove": "string"
}
},
"tags": [
"string"
],
"functionId": "string",
"functionHandle": "string",
"metafields": [
{
"id": "string",
"namespace": "string",
"key": "string",
"value": "string",
"type": "string"
}
],
"appliesOnSubscription": false,
"appliesOnOneTimePurchase": false
}
}
Response
Read the result with {{discountautomaticappcreate.response.data.data.discountAutomaticAppCreate}}. If the API returns errors, the step fails and they are at {{discountautomaticappcreate.response.data.errors}}.
Need more? See the Shopify guide for connection setup and behaviour shared by every action.
Was this page helpful?