For discussing the development and usage of Checkout UI extensions, post-purchase extensions, web pixels, Customer Accounts UI extensions, and POS UI extensions
Hello,
I've set up a shipping discount function, but it seems like it's not working at all. There are no logs or error messages available in the partner dashboard -> app -> extension page, and there's no indication that the function has been invoked. Also, the discount is not being applied to my test orders and I didn't see any error messages when I deploy it.
I'm testing this on fresh new app and store.
Here are the steps I followed to set up a new function:
1. Initialized a new Shopify app with the command: `npm init @Shopify/app@latest`.
2. Generated a shipping discount function extension by running: `npm run shopify app generate extension` and selecting 'shipping discount function' for version 2024-01.
3. Deployed the app using: `npm run deploy`.
I think if there's an issue with the code, it should be logging something. For now, I just want to see if this function is even running. Help please !
Have you entered a shipping address at checkout when testing the discount?
If no shipping address is entered, then shipping rates can't be calculated, so discount functions aren't executed.
I'm having the same issue, same steps, not able to get running.
FYI @Bayarmagnai1 I got this running finally - make sure activate the discount using a GraphQL mutation with the GraphiQL app, here's mine as an example:
mutation ActivateDiscount {
discountAutomaticAppCreate(
automaticAppDiscount: {title: "Shipping Function Discount", functionId: “YOUR-FUNCTION-ID-FOUND-IN-YOUR-ENV-FILE”, startsAt: "2022-06-22", combinesWith: {productDiscounts: true, orderDiscounts: true}}
) {
automaticAppDiscount {
discountId
}
userErrors {
message
field
extraInfo
}
}
}