Shopify Functions Product Discount API multiple discounts

I am creating app with Shopify Functions for applying discounts with Product Discount API .
The project template was taken from https://github.com/Shopify/function-examples/tree/main/sample-apps/discounts-tutorial (Code I am talking about is placed in /extentions/volume/src/main.rs)

Ok(FunctionResult {
    discounts: several_discounts,
    discount_application_strategy: DiscountApplicationStrategy::Maximum,
})

I have faced crucial limitation that it does not allow to apply more than 1 discount.
As FunctionResult I am returning vec of discounts (list of 2 discounts, for example), and want 2 discounts to be applied at the same time. However, it does not happen probably because of DiscountApplicationStrategy which chooses only between First and Maximum discount.

Is there any way to apply all discounts?

We are having the exact same issue! The DiscountApplicationStrategy is limiting us as we want to apply multiple different discounts on multiple products in the same checkout. Are there any solutions here yet?

No solutions yet. Also waiting.

I have the same problem.When will this setting be supported?

Even I am facing the same issue

My function result

{ “discountApplicationStrategy”: “FIRST”, “discounts”: [ { “value”: { “percentage”: { “value”: 4 } }, “targets”: [ { “productVariant”: { “id”: “gid://shopify/ProductVariant/39279386525760”, “quantity”: 1 } } ] }, { “value”: { “percentage”: { “value”: 4 } }, “targets”: [ { “productVariant”: { “id”: “gid://shopify/ProductVariant/39279386492992”, “quantity”: 1 } } ] }, { “value”: { “percentage”: { “value”: 4 } }, “targets”: [ { “productVariant”: { “id”: “gid://shopify/ProductVariant/39279386460224”, “quantity”: 1 } } ] }, { “value”: { “percentage”: { “value”: 4 } }, “targets”: [ { “productVariant”: { “id”: “gid://shopify/ProductVariant/39279386427456”, “quantity”: 1 } } ] } ] }

Just applying a single discount to the cart line even all four variants are there in the cart. Not sure If I am doing something wrong.

Hi @adkhamllama have you found any work around for that? It’s a very critical Limitation and we are also facing it. have you had any luck with that?

Has there been any news? I also have the same problem

We need this also. Has Shopify support responded?

@Shopify_77 Any update on this ?

I also have the same problem, is there any news ?

@rm_mrkb
Shopify has confirmed stacking discounts on line items is a current merchant frustration with Functions, but there’s an active project being worked on by the Discounts product team on it. Which means the team is aware and is working towards fixing this limitation, unfortunately, they do not have any timelines on this

Same problem for me. I’m trying to apply 2 different discounts to 2 different products and it only applies to one product. It seems that there’s no way to add multiple different product discounts neither using shopify functions, neither by applying it in the frontend using /discount/CODE endpoint. Actually it used to work using the /discount/CODE method, and I had managed to add 2 different discounts to cart, but after few weeks shopify decided to change that and it no longer works, although their documentation states otherwise (cart permalinks)

Maybe you know if there’s any news?

I have not heard anything yet!

I have not heard anything yet!

@Shopify_77 Any update on that?

How can we replace Shopify Scripts with the new Functions if half the features are not available in Shopify Functions API? (Merchants are really not pleased at the moment)

+1 on this, this limitation + the limitation of the number of Automatic App Discounts makes impossible for my app to be updated with Shopify Functions.

@Shopify_77 Any update on that? we need it!!!

I can apply 2 discount in 2 differents products, like the print below.

But I want to apply discount if the product has attribute “_x” for exemple, it works partially but if I apply the discount to the product that has this attribute and I add the same product without this attribute on cart the discount will be added to the product without attribute too (if I only add to cart the product without the attribute, discount is not applied).

I think it might be because the target for discount can be only product variant, so the discount is added to this variant id, not the line id. That’s why the discount is applied to all products that has the same variant id, but not same attribute I guess (sorry for my english, I hope you understand it).

Same issue. Kind of insane considering discounts is an array. The output of my function pretends it accepted an array, but it only applies the second one.

{
  "discountApplicationStrategy": "MAXIMUM",
  "discounts": [
    {
      "targets": [
        {
          "productVariant": {
            "id": "gid://shopify/ProductVariant/45993501688108"
          }
        }
      ],
      "value": {
        "percentage": {
          "value": 30
        }
      },
      "message": "30% off readers"
    },
    {
      "targets": [
        {
          "productVariant": {
            "id": "gid://shopify/ProductVariant/45993407512876"
          }
        },
        {
          "productVariant": {
            "id": "gid://shopify/ProductVariant/45993407447340"
          }
        }
      ],
      "value": {
        "percentage": {
          "value": 20
        }
      },
      "message": "20% off polarized sun"
    }
  ]
}

seems like we desperately need a discountApplicationStrategy: ALL