Discussing Shopify Functions development, deployment, and usage in Shopify apps.
Hi all --
I have created and deployed a discount function following the tutorials on my development store. I followed the instructions to create the discount on my development store with the following GraphQL mutation via the GraphQL explorer.
mutation { discountAutomaticAppCreate(automaticAppDiscount: { title: "Volume discount", functionId: "YOUR_FUNCTION_ID_HERE", startsAt: "2022-06-22T00:00:00" }) { automaticAppDiscount { discountId } userErrors { field message } } }
I want to change the "Volume Discount" title to something else, we may have in production basic discounts that we would like to change on a promotional basis -- the code would remain but the discount title would change linked to promotions.
Is there a way to do this? I do not see anything in either the Graphql explorer or the docs.
Thanks.
Solved! Go to the solution
This is an accepted solution.
You should receive it on the response when you create it or you will have to query it.
{
discounts(first: 5) {
edges {
node {
id
title
}
}
}
}
Try using discountAutomaticAppUpdate: https://shopify.dev/docs/api/admin-graphql/2024-01/mutations/discountAutomaticAppUpdate
mutation {
discountAutomaticAppUpdate(
id: "gid://shopify/DiscountNode/YOUR_DISCOUNT_ID_HERE",
automaticAppDiscount: {
title: "New Discount Title"
}
) {
discountNode {
id
}
userErrors {
field
message
}
}
}
Awesome, but how can I find the id: "gid://shopify/DiscountNode/YOUR_DISCOUNT_ID_HERE", is there a way to find the gid ?
Thanks again!
This is an accepted solution.
You should receive it on the response when you create it or you will have to query it.
{
discounts(first: 5) {
edges {
node {
id
title
}
}
}
}
Thanks so much!
You are welcome! Glad I could help!
Any other questions feel free to ask!