Function - Product discount API limited

The only way I was able to achieve this happening was using the “unstable” version of the api and adding it into shopify.extension.toml, and in the schema.graphql I had to append in the “ALL” along with the FIRST and MAXIMUM that is currently present.

Now, I did also use @LizaK point about the Discount Node comment from above, but since I am using an Automatic discount I applied it to that instead, not sure if it made a difference to be honest? Lol..

But anyway this is my output as result

As you can see in the image above I used a fixedAmount in this case, but I am assuming percentage could work as well.

Here are my Input and Output from the Logs in the Partners Dash for some additional context:

{ “cart”: { “lines”: [ { “id”: “gid://shopify/CartLine/0”, “quantity”: 1, “merchandise”: { “__typename”: “ProductVariant”, “id”: “gid://shopify/ProductVariant/47315301466387”, “sku”: “#PIENINJA”, “metafield”: null, “product”: { “metafield”: { “value”: “0.5” } } } }, { “id”: “gid://shopify/CartLine/1”, “quantity”: 1, “merchandise”: { “__typename”: “ProductVariant”, “id”: “gid://shopify/ProductVariant/47318889431315”, “sku”: “#PIEKNIGHT”, “metafield”: null, “product”: { “metafield”: { “value”: “0.2” } } } } ] }, “discountNode”: { “metafield”: { “value”: “{"quantity":1,"percentage":25.0}” } } }

Output:

{ “discountApplicationStrategy”: “ALL”, “discounts”: [ { “message”: “Malibu Dynamic Deal!”, “targets”: [ { “productVariant”: { “id”: “gid://shopify/ProductVariant/47315301466387” } } ], “value”: { “fixedAmount”: { “amount”: “50”, “appliesToEachItem”: true } } }, { “message”: “Malibu Dynamic Deal!”, “targets”: [ { “productVariant”: { “id”: “gid://shopify/ProductVariant/47318889431315” } } ], “value”: { “fixedAmount”: { “amount”: “20”, “appliesToEachItem”: true } } } ] }

But you can see the discountApplicationStrategy being “ALL”

Hope this helps.. Cheers. (granted unstable API, so who knows if Shopify will let this slide through.. haha) – But yeah. Really need this folks. Shopify Scripts, has the ability.. odd that you wouldn’t include it as a bare min in Functions.