Need to implement different discounts on lineitems using Shopify Functions Product Discount API

I am facing an issue while implementing Shopify Functions Discount Product API. Since this API is the replacement of Shopify Scripts, I have faced a crucial limitation in that it does not allow the application of more than 1 discount on Line items. It must be something am missing OR perhaps limitations from Shopify’s side. I need to confirm either Its a limitation or any way to apply multiple different discounts on each Line item using Discount Product API

This output works fine when I use the single discount on all line items:

{
  "discountApplicationStrategy": "FIRST",
  "discounts": [
    {
      "targets": [
        {
          "productVariant": {
            "id": "gid://shopify/ProductVariant/44550030459160"
          }
        },
        {
          "productVariant": {
            "id": "gid://shopify/ProductVariant/44550030557464"
          }
        }
      ],
      "value": {
        "percentage": {
          "value": "10.0"
        }
      }
    }
  ]
}

But when am implementing different discounts on each line item, it works only for a single line item, output of my functions is :

{
  "discountApplicationStrategy": "FIRST",
  "discounts": [
    {
      "targets": [
        {
          "productVariant": {
            "id": "gid://shopify/ProductVariant/44550030295320"
          }
        }
      ],
      "value": {
        "percentage": {
          "value": "15.0"
        }
      }
    },
    {
      "targets": [
        {
          "productVariant": {
            "id": "gid://shopify/ProductVariant/44550030557464"
          }
        }
      ],
      "value": {
        "percentage": {
          "value": "10.0"
        }
      }
    }
  ]
}
3 Likes