Menu
discountCodeAppUpdate
Updates a code discount, where the discount type is provided by an app extension that uses Shopify Functions.
Use it in a workflow
- Add a step and choose the Shopify connector.
- Pick the discountCodeAppUpdate action (under Discount).
- Fill in the fields below, then reference the result from later steps as
{{discountcodeappupdate.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 DiscountCodeAppUpdate($id: ID!, $codeAppDiscount: DiscountCodeAppInput!) {
discountCodeAppUpdate(id: $id, codeAppDiscount: $codeAppDiscount) {
codeAppDiscount {
appDiscountType {
app
appBridge
appKey
description
discountClass
discountClasses
functionId
targetType
title
}
appliesOnOneTimePurchase
appliesOnSubscription
appliesOncePerCustomer
asyncUsageCount
codesCount {
count
precision
}
combinesWith {
orderDiscounts
productDiscounts
productDiscountsWithTagsOnSameCartLine
shippingDiscounts
}
context
createdAt
customerSelection
discountClass
discountClasses
discountId
endsAt
errorHistory {
errorsFirstOccurredAt
firstOccurredAt
hasBeenSharedSinceLastError
hasSharedRecentErrors
}
hasTimelineComment
recurringCycleLimit
shareableUrls {
targetItemImage
targetType
title
url
}
startsAt
status
tags
title
totalSales {
amount
currencyCode
}
updatedAt
usageLimit
}
userErrors {
code
extraInfo
field
message
}
}
}
Variables
Pass these as a JSON object in the step's Variables field.
{
"id": "string",
"codeAppDiscount": {
"combinesWith": {
"productDiscounts": false,
"orderDiscounts": false,
"shippingDiscounts": false,
"productDiscountsWithTagsOnSameCartLine": {
"add": "string",
"remove": "string"
}
},
"discountClasses": [
"PRODUCT"
],
"title": "string",
"startsAt": "string",
"endsAt": "string",
"appliesOncePerCustomer": false,
"code": "string",
"customerSelection": {
"all": false,
"customers": {
"add": "string",
"remove": "string"
},
"customerSegments": {
"add": "string",
"remove": "string"
}
},
"usageLimit": 0,
"context": {
"all": "ALL",
"customers": {
"add": "string",
"remove": "string"
},
"customerSegments": {
"add": "string",
"remove": "string"
},
"markets": {
"add": "string",
"remove": "string"
}
},
"tags": [
"string"
],
"functionId": "string"
}
}
Response
Read the result with {{discountcodeappupdate.response.data.data.discountCodeAppUpdate}}. If the API returns errors, the step fails and they are at {{discountcodeappupdate.response.data.errors}}.
Need more? See the Shopify guide for connection setup and behaviour shared by every action.
Was this page helpful?