Menu
discountAutomaticAppUpdate
Updates an existing automatic discount that's managed by an app using Shopify Functions. Use this mutation when you need advanced, custom, or dynamic discount capabilities that aren't supported by Shopify's native…
Use it in a workflow
- Add a step and choose the Shopify connector.
- Pick the discountAutomaticAppUpdate action (under Discount).
- Fill in the fields below, then reference the result from later steps as
{{discountautomaticappupdate.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 DiscountAutomaticAppUpdate($id: ID!, $automaticAppDiscount: DiscountAutomaticAppInput!) {
discountAutomaticAppUpdate(id: $id, 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.
{
"id": "string",
"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 {{discountautomaticappupdate.response.data.data.discountAutomaticAppUpdate}}. If the API returns errors, the step fails and they are at {{discountautomaticappupdate.response.data.errors}}.
Need more? See the Shopify guide for connection setup and behaviour shared by every action.
Was this page helpful?