Query price rules for automated pricing based on conditions.
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": []
}
}
}
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
}
| Field | Type | Description |
|---|
id | Int | Unique identifier. |
label | String | Name of the rule. |
active | Boolean | True if the rule is active. |
selection_type | SelectionType | Defines the target products for the rule. |
price_level | PriceLevel | Target price level for the rule. |
price_type | PriceType | Set directly or dynamically calculated. |
base_price | BasePrice | Used if price type is calculated. |
base_price_price_level | PriceLevel | Used if base_price is 'price_level'. |
operator | Operator | Math operation applied to the base price. |
value | Float | Value used with the operator. |
round | Int | Decimal rounding. |
currency_condition | Currency | Applicable currency. |
start_date_condition | Date | Active from date. |
end_date_condition | Date | Active 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. |
| Field | Example |
|---|
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 } |
| Value | Description |
|---|
all_products | Applies to all products. |
selected_attributes | Applies to exact attributes. |
selected_tags | Applies to specific product tags. |
selected_variants | Applies to exactly selected variants. |
| Value | Description |
|---|
set | Fixed price amount. |
calculated | Dynamic calculation based on rules. |
| Value | Description |
|---|
add | Base Price + Value. |
multiply | Base Price * Value. |
minus | Base Price - Value. |
| Value | Description |
|---|
unit_cost | Calculated from product unit cost. |
last_purchased_price | Calculated from the last purchase price. |
price_level | Calculated from another price level. |