i have created new discount function with new APIs, i am trying to create a order discount, with conistions of minimum order subtotal value some percentage to be applied. When i am applying the discount in checkout, the function is triggering but not applying discount. There is only one active discount on my store and its saying “PRODUCT50 discount code isn’t valid for the items in your cart”. When i deploy function after removing the conditions array, then the discount is being applied
orderDiscountsAdd: {
candidates: [
{
message: '50% OFF ORDER',
associatedDiscountCode:{
code: "PRODUCT50"
},
conditions: [
{
orderMinimumSubtotal: {
excludedCartLineIds: [],
minimumAmount: "1000.00"
}
}
],
targets: [
{
orderSubtotal: {
excludedCartLineIds: [],
},
},
],
value: {
percentage: {
value: "50.0",
},
},
},
],
selectionStrategy: OrderDiscountSelectionStrategy.First,
},
Cart input →
{
“cart”: {
“attribute”: null,
“lines”: [
{
“id”: “gid://shopify/CartLine/0”,
“merchandise”: {
“id”: “gid://shopify/ProductVariant/47307141677296”
},
“cost”: {
“subtotalAmount”: {
“amount”: “2900.0”
}
}
}
]
},
“discount”: {
“discountClasses”: [
“ORDER”
],
}
}