I have a Typescript Shipping Discount function which runs successfully with no errors. The discount message appears beside the shipping cost but the discount is not being applied.
Here are screenshots of the shipping options and discount message:
This is the code for my function result:
{
discountApplicationStrategy: DiscountApplicationStrategy.Maximum,
discounts: [
{
message: 'Shipping Discount',
targets: input.cart.deliveryGroups.map(group => ({
deliveryGroup: {
id: group.id,
},
})),
value: {
percentage: {
value: '100.0',
},
},
},
],
}
Here is the logged Input from the partner dashboard:
{
"cart": {
"buyerIdentity": {
"customer": {
"isPro": true
}
},
"cost": {
"subtotalAmount": {
"amount": "24.9"
}
},
"deliveryGroups": [
{
"deliveryAddress": {
"zip": "3214"
},
"deliveryOptions": [
{
"cost": {
"amount": "0.0"
},
"title": "Standard Delivery"
},
{
"cost": {
"amount": "5.95"
},
"title": "Standard Delivery (Signature Required)"
},
{
"cost": {
"amount": "9.99"
},
"title": "Same Day Delivery"
},
{
"cost": {
"amount": "10.99"
},
"title": "Same Day Delivery (Signature Required)"
}
],
"id": "gid://shopify/CartDeliveryGroup/0"
}
]
}
}
Here is the logged Output of the function from the partner dashboard:
{
"discountApplicationStrategy": "MAXIMUM",
"discounts": [
{
"message": "Shipping Discount",
"targets": [
{
"deliveryGroup": {
"id": "gid://shopify/CartDeliveryGroup/0"
}
}
],
"value": {
"percentage": {
"value": "100.0"
}
}
}
]
}
I’m using api version 2023-07. I’ve also tried using 2023-01, and I’ve tried applying different percentages, fixedAmount discounts rather than percentages, and also using FIRST for discountApplicationStrategy to no avail.
Any thoughts would be much appreciated!

