Overview
Discount Entitlements enable you to apply dynamic discounts to products in both Search and Browse API responses. This feature is part of Layers’ partnership with Abra Promotions, ensuring that sorting and filtering operations work correctly with dynamically discounted prices. When discount entitlements are provided in API requests, Layers automatically adjusts product pricing in the response and applies the discounts when sorting by price or filtering by price ranges. This ensures customers see accurate, discounted pricing throughout their shopping experience.Use Cases
Discount entitlements are ideal for scenarios where you need to:- Apply percentage-based discounts to specific products, variants, or collections
- Offer fixed amount discounts on selected items
- Implement store-wide sales or promotions
- Create targeted discount campaigns for specific product categories
- Ensure accurate price sorting and filtering with active promotions
Schema
The discount entitlements schema consists of two main components: the entitlement criteria and the discount configuration.Entitlement Criteria
Theentitled
object defines which products qualify for the discount:
When
true
, applies the discount to all products in the catalog. When false
, discount is limited to specified products, variants, or collections.Array of product IDs or handles that qualify for the discount. Can be empty if using
all: true
or targeting specific variants/collections.Array of variant IDs that qualify for the discount. Allows targeting specific product variants rather than entire products.
Array of collection handles that qualify for the discount. All products within these collections will receive the discount.
Discount Configuration
Thediscount
object defines the discount to apply:
The discount type. Must be either:
PERCENTAGE
- Discount is a percentage off the original priceFIXED_AMOUNT
- Discount is a fixed currency amount off the original price
The discount value. For
PERCENTAGE
type, this is the percentage (e.g., 10 for 10% off). For FIXED_AMOUNT
type, this is the currency amount to deduct from the price.Examples
Store-Wide Percentage Discount
Apply a 10% discount to all products:Fixed Amount Discount on Specific Products
Apply a $5.00 discount to specific products by handle:Percentage Discount on Specific Variants
Apply a 20% discount to specific product variants:Collection-Wide Discount
Apply a 15% discount to all products in a collection:Using with Browse API
To apply discount entitlements when browsing a collection, include thediscountEntitlements
array in your Browse API request:
Using with Search API
To apply discount entitlements when searching, include thediscountEntitlements
array in your Search API request:
Multiple Discount Entitlements
You can provide multiple discount entitlements in a single request. When multiple entitlements apply to the same product, the system will use the most advantageous discount for the customer:Important Considerations
Price Sorting
When discount entitlements are applied, price-based sort orders will use the discounted prices. This ensures products are correctly ordered according to their effective prices after discounts.Price Filtering
Price range filters will also respect discount entitlements. When filtering by price, products will be evaluated based on their discounted prices, not their original prices.Product Response
The product response will reflect the discounted pricing in thefirst_or_matched_variant.price
field when discount entitlements are applied. This ensures consistency between what customers see in search/browse results and what they’ll see on product pages. The first_or_matched_variant.compare_at_price
is not updated.
Related Features
- Browse API - Collection browsing with discount support
- Search API - Semantic search with discount support
- Sorting - Custom sort orders that work with discounted prices
- Filtering - Price filtering with discount awareness
- Abra Promotions - Partner platform for advanced promotional strategies