[Bug] discountApplicationStrategy with `All` Type not working when using with multiple variants

JackL
Shopify Partner
14 0 9

We have a app that with a function that using discountApplicationStrategy with `All` to have multiple multiple discounts applied to same product variant

the following output is for when same product and only 1 variant:

 

{
  "discountApplicationStrategy": "ALL",
  "discounts": [
    {
      "value": {
        "percentage": {
          "value": 20
        }
      },
      "targets": [
        {
          "productVariant": {
            "id": "gid://shopify/ProductVariant/46960668311869",
            "quantity": 5
          }
        }
      ],
      "message": "Volume discount"
    },
    {
      "value": {
        "percentage": {
          "value": 10
        }
      },
      "targets": [
        {
          "productVariant": {
            "id": "gid://shopify/ProductVariant/46960668311869",
            "quantity": 3
          }
        }
      ],
      "message": "Volume discount"
    }
  ]
}

This do working as expected, the two discounts is applied correctly, the following is the result:

 

JackL_0-1714702883122.png

 

BUT, when it involved with 2 variants from the same product, the second's discount is not applied correctly

the following is the output and result:

{
  "discountApplicationStrategy": "ALL",
  "discounts": [
    {
      "value": {
        "percentage": {
          "value": 20
        }
      },
      "targets": [
        {
          "productVariant": {
            "id": "gid://shopify/ProductVariant/46960668311869",
            "quantity": 3
          }
        },
        {
          "productVariant": {
            "id": "gid://shopify/ProductVariant/46960668377405",
            "quantity": 2
          }
        }
      ],
      "message": "Volume discount"
    },
    {
      "value": {
        "percentage": {
          "value": 10
        }
      },
      "targets": [
        {
          "productVariant": {
            "id": "gid://shopify/ProductVariant/46960668311869",
            "quantity": 3
          }
        }
      ],
      "message": "Volume discount"
    }
  ]
}

JackL_1-1714702973799.png

We believed this is a bug as it is working when only single variant but not when multiple

Please let us know or if the Shopify's function expecting any format of output to handle this situation

Thanks in advance!

Replies 0 (0)