When you are done with coding of function you have to deploy the app on to your store. Once you have deployed it. In you .env file the app will create a function id of that Shopify Function and then you can use discountAutomaticAppCreate make the mutation the file should be like the below image
`#graphql
mutation discountAutomaticAppCreate($automaticAppDiscount: DiscountAutomaticAppInput!) {
discountAutomaticAppCreate(automaticAppDiscount: $automaticAppDiscount) {
userErrors {
field
message
}
automaticAppDiscount {
discountId
title
startsAt
endsAt
status
appDiscountType {
appKey
functionId
}
}
}
}`,
{
variables: {
automaticAppDiscount: {
title: discount_title,
functionId: "you function id goes here",
startsAt: enter a starting date it is compulsory
endsAt: null,
}
},
},
);
