Skip to content

Add discount code reference to cart warnings for multi-discount scenarios #815

@MTaran-89

Description

@MTaran-89

Hi team,

We are facing an issue while working with multiple discount codes in the Shopify Android Buy SDK / Storefront Cart API integration.

Currently, when cart warnings are returned after applying discount codes, the warning object does not contain any information about which specific discount code caused the warning.

This becomes a problem in multi-discount scenarios:

  • Multiple discount codes can be applied to the cart
  • One or more of them may become invalid/inapplicable
  • The invalid discount code remains inside the cart discount codes list
  • Warnings continue to be returned on every cart query/update
  • However, since the warning is not linked to a specific discount code, we cannot determine which code should be removed from the cart

Additionally, the warning order is not stable:

  • The warning for the last applied discount code is not always the first warning returned
  • Because of this, matching warnings by index/order is unreliable

Example scenario:

  1. Apply multiple discount codes
  2. One discount becomes invalid due to cart conditions
  3. Cart returns warnings
  4. Warning does not indicate which discount code caused it
  5. Client cannot safely remove the invalid discount code

Would it be possible to include the related discount code inside the warning payload?

For example, something like:

{
  "code": "DISCOUNT_NOT_FOUND",
  "message": "Discount code is invalid",
  "discountCode": "SUMMER10"
}

This would make it possible for clients to correctly identify and remove invalid discount codes in multi-discount flows.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions