CreatePriceRule
CreatePriceRuleCreates a new price rule.
Parameters:
| Parameter | Type | Description |
|---|---|---|
input | PriceRuleInput! | Price rule data. |
Example Query:
mutation CreatePriceRule($input: PriceRuleInput!) {
CreatePriceRule(input: $input) {
id
label
active
}
}Example Variables:
{
"input": {
"label": "Summer Discount",
"active": true,
"selection_type": "all_products",
"price_type": "calculated",
"base_price": "unit_cost",
"operator": "multiply",
"value": 1.2
}
}UpdatePriceRule
UpdatePriceRuleUpdates an existing price rule.
Parameters:
| Parameter | Type | Description |
|---|---|---|
id | Int! | ID of the price rule. |
input | PriceRuleInput! | Updated data. |
Example Query:
mutation UpdatePriceRule($id: Int!, $input: PriceRuleInput!) {
UpdatePriceRule(id: $id, input: $input) {
id
label
}
}DeletePriceRule
DeletePriceRuleDeletes a price rule.
Parameters:
| Parameter | Type | Description |
|---|---|---|
id | Int! | ID of the price rule to delete. |
DisablePriceRule
DisablePriceRuleDeactivates a price rule.
Parameters:
| Parameter | Type | Description |
|---|---|---|
id | Int! | ID of the price rule to disable. |
EnablePriceRule
EnablePriceRuleRe-activates a previously disabled price rule.
Parameters:
| Parameter | Type | Description |
|---|---|---|
id | Int! | ID of the price rule to enable. |
Input Data Types
PriceRuleInput
PriceRuleInput| Field | Type | Description |
|---|---|---|
id | Int | ID. |
label | String | Name of the rule. |
active | Boolean | True if the rule is activated. |
selection_type | SelectionType | Defines target scope. |
price_level_id | Int | Target PriceLevel ID. |
price_type | PriceType | Set directly or dynamically calculated. |
base_price | BasePrice | Used if price type is calculated. |
base_price_price_level | PriceLevelInput | Target for the calculation. |
operator | Operator | Calculation type. |
value | Float | Constant to pair with the operator. |
round | Int | Precision value. |
start_date_condition | Date | Active from date. |
end_date_condition | Date | Active until date. |
currency_condition | CurrencyInput | Currency mapping filter. |
variants | [VariantInput] | Selected variants. |
attributes | [AttributeInput] | Selected attributes. |
product_tags | [ProductTagInput] | Selected product tags. |
seasons_condition | [SeasonInput] | Active seasons. |
locations_condition | [LocationInput] | Applicable locations. |
customer_tags_condition | [CustomerTagInput] | Applicable customer tags. |
Enums
SelectionType
SelectionType| 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. |
PriceType
PriceType| Value | Description |
|---|---|
set | Fixed price amount. |
calculated | Dynamic calculation based on rules. |
Operator
Operator| Value | Description |
|---|---|
add | Base Price + Value. |
multiply | Base Price * Value. |
minus | Base Price - Value. |
BasePrice
BasePrice| 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. |
