Price Rules Queries

Query price rules for automated pricing based on conditions.

PriceRule — Returns a single price rule by id

Example Query:

query GetPriceRule($id: ID!) {
  PriceRule(id: $id) {
    id
    label
    active
    selection_type
    price_level { id label }
    price_type
    base_price
    operator
    value
    round
    start_date_condition
    end_date_condition
    variants { id label }
  }
}

Example Result:

{
  "data": {
    "PriceRule": {
      "id": 10001,
      "label": "Summer Discount",
      "active": true,
      "selection_type": "all_products",
      "price_level": { "id": 5001, "label": "Retail" },
      "price_type": "calculated",
      "base_price": "unit_cost",
      "operator": "multiply",
      "value": 1.2,
      "round": 2,
      "start_date_condition": "2025-06-01",
      "end_date_condition": "2025-08-31",
      "variants": []
    }
  }
}

PriceRules — Returns a list of price rules with sorting and filters

Example Query:

query PriceRules(
  $where: QueryPriceRulesWhereWhereConditions,
  $orderBy: [QueryPriceRulesOrderByOrderByClause!],
  $search: String,
  $first: Int,
  $page: Int
) {
  PriceRules(
    where: $where,
    orderBy: $orderBy,
    search: $search,
    first: $first,
    page: $page
  ) {
    paginatorInfo {
      total
      currentPage
    }
    data {
      id
      label
      active
      base_price
    }
  }
}

Example Variables:

{
  "where": {
    "AND": [
      { "column": "ACTIVE", "operator": "EQ", "value": true },
      { "column": "SELECTION_TYPE", "operator": "EQ", "value": "all_products" }
    ]
  },
  "first": 50,
  "page": 1
}

Available fields

FieldTypeDescription
idIntUnique identifier.
labelStringName of the rule.
activeBooleanTrue if the rule is active.
selection_typeSelectionTypeDefines the target products for the rule.
price_levelPriceLevelTarget price level for the rule.
price_typePriceTypeSet directly or dynamically calculated.
base_priceBasePriceUsed if price type is calculated.
base_price_price_levelPriceLevelUsed if base_price is 'price_level'.
operatorOperatorMath operation applied to the base price.
valueFloatValue used with the operator.
roundIntDecimal rounding.
currency_conditionCurrencyApplicable currency.
start_date_conditionDateActive from date.
end_date_conditionDateActive until date.
variants[Variant]Selected variants if selection_type is selected_variants.
attributes[Attribute]Selected attributes.
product_tags[ProductTag]Selected product tags.
seasons_condition[Season]Active seasons.
customer_tags_condition[CustomerTag]Applicable customer tags.
locations_condition[Location]Applicable locations.

Filters

FieldExample
id{ "column": "ID", "operator": "EQ", "value": 10001 }
label{ "column": "LABEL", "operator": "LIKE", "value": "%Summer%" }
active{ "column": "ACTIVE", "operator": "EQ", "value": true }
selection_type{ "column": "SELECTION_TYPE", "operator": "EQ", "value": "all_products" }
price_type{ "column": "PRICE_TYPE", "operator": "EQ", "value": "calculated" }
base_price{ "column": "BASE_PRICE", "operator": "EQ", "value": "unit_cost" }
price_level_id{ "column": "PRICE_LEVEL_ID", "operator": "EQ", "value": 5001 }
condition_start_date{ "column": "CONDITION_START_DATE", "operator": "GTE", "value": "2025-01-01" }
condition_end_date{ "column": "CONDITION_END_DATE", "operator": "LTE", "value": "2025-12-31" }
variant_id{ "column": "VARIANT_ID", "operator": "EXISTS", "value": 300 }

Enums

SelectionType

ValueDescription
all_productsApplies to all products.
selected_attributesApplies to exact attributes.
selected_tagsApplies to specific product tags.
selected_variantsApplies to exactly selected variants.

PriceType

ValueDescription
setFixed price amount.
calculatedDynamic calculation based on rules.

Operator

ValueDescription
addBase Price + Value.
multiplyBase Price * Value.
minusBase Price - Value.

BasePrice

ValueDescription
unit_costCalculated from product unit cost.
last_purchased_priceCalculated from the last purchase price.
price_levelCalculated from another price level.