Product predicate language

Product predicates are used by product discounts.

They do not run against a cart. Instead, Thor validates the expression against a product-discount DSL and evaluates it against currently valid prices, variants, products, channels, countries, and customer groups.

Use this language for:

  • ProductDiscount.predicate

Available context

The product-discount DSL exposes these fields:

  • sku
  • country_code
  • channel.id
  • customer_group.id
  • product.id, product.name, product.slug
  • product.collections
  • variant.id, variant.name
  • price.id, price.amount, price.currency

Empty predicates are normalized to True.

Matching behavior

Thor evaluates product predicates against price records that are currently valid by time window. That means a product discount does not just match products abstractly, it matches concrete prices that are active now.

This is why channel, customer-group, country, currency, and price amount are all available in the predicate context.