Query price rules for automated pricing based on conditions.
Example Query:
GraphQL
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:
JSON
{
"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:
GraphQL
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:
JSON
{
"where": {
"AND": [
{ "column": "ACTIVE", "operator": "EQ", "value": true },
{ "column": "SELECTION_TYPE", "operator": "EQ", "value": "all_products" }
]
},
"first": 50,
"page": 1
}
Field Type Description idInt Unique identifier. labelString Name of the rule. activeBoolean True if the rule is active. selection_typeSelectionType Defines the target products for the rule. price_levelPriceLevel Target price level for the rule. price_typePriceType Set directly or dynamically calculated. base_priceBasePrice Used if price type is calculated. base_price_price_levelPriceLevel Used if base_price is 'price_level'. operatorOperator Math operation applied to the base price. valueFloat Value used with the operator. roundInt Decimal rounding. currency_conditionCurrency Applicable currency. start_date_conditionDate Active from date. end_date_conditionDate 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_productsApplies to all products. selected_attributesApplies to exact attributes. selected_tagsApplies to specific product tags. selected_variantsApplies to exactly selected variants.
Value Description setFixed price amount. calculatedDynamic calculation based on rules.
Value Description addBase Price + Value. multiplyBase Price * Value. minusBase Price - Value.
Value Description unit_costCalculated from product unit cost. last_purchased_priceCalculated from the last purchase price. price_levelCalculated from another price level.