Discount missing from Sections API response when using order_discount function, sometimes

Topic summary

A developer is experiencing inconsistent behavior with the Sections API when implementing a tiered order discount function (3 tiers: $10 off at $100+, $20 off at $200+, $30 off at $300+) using DiscountApplicationStrategy::MAXIMUM.

Core Issue:

  • In the cart drawer component (Dawn theme), discounts intermittently disappear from the Sections API response
  • Specifically occurs when changing cart quantity to 2, regardless of initial state
  • Discount appears correctly at quantities 1, 3, and 4
  • The discount shows properly in /cart.json and after page refresh, but not in the live Sections API response

Workarounds Tested:

  • Reducing to a single discount with FIRST strategy resolves the issue
  • However, switching to percentage discounts triggers similar problems at different price points

Environment:

  • Dev store with extensibility preview build
  • Dawn 11.0.0 theme
  • Issue persists in both preview and deployed versions

The developer has provided detailed input/output JSON (appears corrupted/reversed in the post) and is seeking confirmation if others have encountered this bug with multiple discounts in the order_discount function.

Summarized with AI on November 17. AI used: claude-sonnet-4-5-20250929.

I’m noticing some strange behavior when multiple discounts are returned using order_discount api with DiscountApplicationStrategy::MAXIMUM. Curious if anyone else has seen something like this..

I’m porting a standard 3-tier discount from a Ruby script for a client. When the cart total is $100+ in $10 discount, $200+, $20 discount, $300+, $30 discount. About as simple as it gets.

Wrote & deployed the script and testing on the default ‘Test Data’ theme ( Dawn 11.0.0). The environment is a dev store w/extensibility preview build. In checkout, everything works fine, but on the online storefront I’m noticing the discount is sometimes dropped from the section api response when using the component from Dawn

Specifically, whenever I increase the quantity in cart from 1 to 2, the order discount disappears from the cart drawer. However, it appears again when I change the quantity of 1, 3, and 4. if I refresh, the discount is rendered, and if I check /cart.json before refreshing I see the discount as it should be.

It’s just weird, like, no matter what the quantity is in the initial cart state, whenever I change the quantity to 2 the discount is not returned from the section api. It’s happening every single time and only at that specific quantity.

As a test, I changed my function so that only one discount is returned in the output array, and changed the discountApplicationStrategy to “FIRST” for this discount - this resolved the issue and the function works at each quantity. However, when implementing a percentage discount instead of fixed, I noticed the same issue at a different price point.

For reference here is the input and output that gives me this behavior. Issue occurs in preview mode as well as with a deployed version.

INPUT

{
  "cart": {
    "cost": {
      "totalAmount": {
        "amount": "1200.0"
      },
      "subtotalAmount": {
        "amount": "1200.0"
      },
      "totalDutyAmount": null,
      "totalTaxAmount": null
    }
  },
  "discountNode": {
    "metafield": {
      "value": {
        "tiers": [
          {
            "value": "10.00",
            "minTotal": "100.00",
            "maxTotal": "-1.00",
            "message": "$10 off"
          },
          {
            "value": "20.00",
            "minTotal": "200.00",
            "maxTotal": "-1.00",
            "message": "$20 off"
          },
          {
            "value": "30.00",
            "minTotal": "300.00",
            "maxTotal": "-1.00",
            "message": "$30 off"
          }
        ]
      }
    }
  }
}

OUTPUT

{
  "discountApplicationStrategy": "MAXIMUM",
  "discounts": [
    {
      "conditions": [
        {
          "orderMinimumSubtotal": {
            "excludedVariantIds": [],
            "minimumAmount": "100",
            "targetType": "ORDER_SUBTOTAL"
          }
        }
      ],
      "message": "$10 off",
      "targets": [
        {
          "orderSubtotal": {
            "excludedVariantIds": []
          }
        }
      ],
      "value": {
        "fixedAmount": {
          "amount": "10"
        }
      }
    },
    {
      "conditions": [
        {
          "orderMinimumSubtotal": {
            "excludedVariantIds": [],
            "minimumAmount": "200",
            "targetType": "ORDER_SUBTOTAL"
          }
        }
      ],
      "message": "$20 off",
      "targets": [
        {
          "orderSubtotal": {
            "excludedVariantIds": []
          }
        }
      ],
      "value": {
        "fixedAmount": {
          "amount": "20"
        }
      }
    },
    {
      "conditions": [
        {
          "orderMinimumSubtotal": {
            "excludedVariantIds": [],
            "minimumAmount": "300",
            "targetType": "ORDER_SUBTOTAL"
          }
        }
      ],
      "message": "$30 off",
      "targets": [
        {
          "orderSubtotal": {
            "excludedVariantIds": []
          }
        }
      ],
      "value": {
        "fixedAmount": {
          "amount": "30"
        }
      }
    }
  ]
}