Need to create rules based on bundles?
Learn more
LogoLogo
APIsChangelog
  • Getting started
  • Rules
  • Conditions
    • Scope
    • Aggregations
    • Nested
    • Dynamic values
  • Actions
    • Types
      • Percentage
      • Fixed amount
      • Fixed price
      • Buy X pay Y
      • Every X discount Y
    • Bundle
      • Balanced
      • Every
    • Aggregation
    • Limit
  • Matchers
  • Operators
  • Check and validation
  • Core API integration
    • Order rules
    • Price rules
    • Virtual relationships
  • Resources
    • Promotions
    • Price lists
  • Use cases
    • Promotions
      • Discount line items based on item's price
      • Get a discount when paying by credit card
      • Discount an order based on promo item and total number of items
      • Offer a specific shipping method for free in a specific country
      • Discount items with large stock availability
      • Discount all the SKU in an order based on the shipping country
      • Discount all the SKU in an order based on the customer email domain
    • Price lists
      • Discount all prices greater than or equal to a specific value
      • Discount specific SKUs for new clients
      • Change strike-through price based on customer email domain
On this page
  1. Conditions

Scope

How to change a condition's scope

PreviousConditionsNextAggregations

Last updated 4 months ago

A condition is checked against a specific payload to determine whether it's a match or not. The payload can contain several instances of the resources specified in the condition's field. By default a condition is considered satisfied if at least one (i.e. any) of those instances matches the condition's requirements. If you want to override this behavior and ensure that a condition is satisfied only if all of those instances match the condition's requirements, you need to modify the condition scope.

Example

Let's consider the and add the scope key with value all to the second condition to better understand how the matching criteria change:

The following couple of conditions check if an order is tagged as dropship and contains at least a line item whose SKU code starts with the string TSHIRT:

"conditions": [
  {
    "field": "order.tags.name",
    "matcher": "eq",
    "value": "dropship"
  },
  {
    "field": "order.line_items.sku.code",
    "matcher": "start_with",
    "value": "TSHIRT",
    "group": "tshirts"
  }
]

The same couple of conditions now check if an order is tagged as dropship and the SKU code of all its line items associated with an SKU starts with the string TSHIRT:

"conditions": [
  {
    "field": "order.tags.name",
    "matcher": "eq",
    "value": "dropship"
  },
  {
    "field": "order.line_items.sku.code",
    "matcher": "start_with",
    "value": "TSHIRT",
    "scope": "all",
    "group": "tshirts"
  }
]

previous example