dk:live — both automatic and code-based. It doesn’t filter by who’s viewing the page, what market they’re in, or what’s already in their cart. Use these inline Liquid patterns to do that filtering in your theme.
The
max_reward_percent and max_reward_cents scalar metafields automatically exclude targeted discounts (test mode, GWP, customer-tagged, market-specific, and code-based). If you use the scalar metafields for badges, no filtering is needed. The patterns below are only needed when working with the full discounts array.Filtering by Method (Automatic vs Code)
Each discount in thediscounts array carries a method field of either 'automatic' or 'code'. Split your rendering accordingly:
Hiding Codes Already Applied to the Cart
When a shopper has already entered a discount code, advertising it again is noise. Compare the code againstcart.discount_applications to detect what’s in play:
Shopify normalises discount codes case-insensitively at checkout, so we
downcase both sides of the comparison. The cart.discount_applications array is populated server-side on each page render, so this works without any JavaScript.Filtering Test Mode Discounts
Discounts in test mode only apply to customers taggedtest. Use the test field to exclude them from your storefront display.
Filtering by Market
Discounts can be restricted to specific Shopify Markets. Filter to show only those applicable to the customer’s current market.How It Works
- Uses
localization.market.handleto identify the current market - Empty
included_marketsmeans the discount applies to all markets - If
included_marketshas values, the current market must match - Checks
excluded_marketsto exclude specific markets
Complete Example
Filtering by Customer Tags
Discounts can target specific customers using tags. Filter to show only those applicable to the current customer.How It Works
- Included Tags: Customer must have at least one tag from
included_customer_tags - Excluded Tags: Customer must not have any tag from
excluded_customer_tags - Not Logged In: Customers who aren’t logged in are excluded from tag-targeted discounts
Complete Example
Combined Filtering
Combine both market and customer tag checks for complete eligibility filtering:Next Steps
- Learn how to access discount data
- View complete examples
- Check the full reference