Discussing Shopify Functions development, deployment, and usage in Shopify apps.
Hello there,
I've created an Order Discount function that, for testing purposes, always returns a discount. Here's the code:
export function run(input: RunInput): FunctionRunResult {
return {
discountApplicationStrategy: DiscountApplicationStrategy.First,
discounts: [
{
targets: [
{
orderSubtotal: {
excludedVariantIds: [],
},
},
],
value: {
fixedAmount: {
amount: 7
},
},
},
],
};
}
All seems fine as it is applied in cart/checkout pages and is subtracted from the order's subtotal. Unfortunately, it is not visible in the Thank You page. The displayed Total is correct (discounted), but there is no indication that it is from my discount. Images shared below. Am I doing something wrong, or is this the expected behavior?
Checkout (all good here):
Thank you page (missing discount line)
Thanks in advance!
Regards,
Delyan