Do Shopify discount functions override the result

Do Shopify discount functions override the result?
Can’t they work together?

For example, if I have two discount functions one results in

"operations": [
        {
          "productDiscountsAdd": {
            "candidates": [
              {
                "message": "Discount A - 10% OFF",
                "targets": [
                  {
                    "cartLine": {
                      "id": "gid://shopify/CartLine/1",
                      "quantity": 1
                    }
                  },
                  {
                    "cartLine": {
                      "id": "gid://shopify/CartLine/0",
                      "quantity": 1
                    }
                  }
                ],
                "value": {
                  "percentage": {
                    "value": 10
                  }
                }
              }
            ],
            "selectionStrategy": "ALL"
          }
        }
      ]

and the other one results in

"operations": [
        {
          "productDiscountsAdd": {
            "candidates": [
              {
                "message": "Discount B - 7% OFF",
                "targets": [
                  {
                    "cartLine": {
                      "id": "gid://shopify/CartLine/3",
                      "quantity": 1
                    }
                  }
                ],
                "value": {
                  "percentage": {
                    "value": 7
                  }
                }
              }
            ],
            "selectionStrategy": "ALL"
          }
        }
      ]

Only one of them gets applied.

Yes, they work together using regular Shopify discount combinations. Here you’ll want both to combine with other product level discounts.

If they both target the same cart line, Shopify will only apply the better of the two discounts at that cart line.

If you return multiple discounts targeting the same cart line from the same discount function, it will take the first matching discount.

I have two functions each outputs operations not targeting the same line but Shopify only applies one of them

And what are the ‘combinesWith’ settings for these two discounts?

I’m seeing something similar too. It happens even within a single function. It seems like the behavior has changed since the legacy discounts. In the past, the discounts would behave as your described, the largest discount would be chosen. It doesn’t seem to do that now.

{
  "operations": [
    {
      "productDiscountsAdd": {
        "candidates": [
          {
            "associatedDiscountCode": null,
            "message": "3 for 2 Least Expensive (2 uses)",
            "targets": [
              {
                "cartLine": {
                  "id": "gid:\/\/shopify\/CartLine\/0",
                  "quantity": 1
                }
              }
            ],
            "value": {
              "percentage": {
                "value": "90.0"
              }
            }
          },
          {
            "associatedDiscountCode": null,
            "message": "1% OFF!",
            "targets": [
              {
                "cartLine": {
                  "id": "gid:\/\/shopify\/CartLine\/0",
                  "quantity": null
                }
              }
            ],
            "value": {
              "percentage": {
                "value": "1.0"
              }
            }
          },
          {
            "associatedDiscountCode": null,
            "message": "1% OFF!",
            "targets": [
              {
                "cartLine": {
                  "id": "gid:\/\/shopify\/CartLine\/1",
                  "quantity": null
                }
              }
            ],
            "value": {
              "percentage": {
                "value": "1.0"
              }
            }
          }
        ],
        "selectionStrategy": "ALL"
      }
    }
  ]
}

This results in the only 1% off being applied rather than the first line getting 95% off one items and the remaining lines get the 1% off discount. I’ve tried specifying exact quantities rather than null and its the same behavior.
If I explicitly look at all the discounts and manage the quantities it works, but you can’t do that in the multiple function case since the functions are running in parallel.

This is in version 2025-07