Condition Operators
Conditions let you restrict when a shipping rule applies. A rule only fires when every condition on it passes. Conditions are split into three categories based on the field they test.
Quick reference
Section titled “Quick reference”| Category | Fields | Operators | Value type |
|---|---|---|---|
| Numeric | cart_total_price, cart_total_weight, cart_item_count | eq, gte, lte, between | Number (single value, or two values for between) |
| Location | destination_country, destination_province | eq, in, not_in | String or array of strings |
| Item | item_vendor, item_product_title, item_sku | eq, contains, does_not_contain, starts_with, does_not_start_with, ends_with, does_not_end_with, in, not_in | String or array of strings |
Numeric operators
Section titled “Numeric operators”Test the cart’s total price (cents), total weight (grams) or item count.
| Operator | Passes when |
|---|---|
eq | Cart value equals value. |
gte | Cart value is greater than or equal to value. |
lte | Cart value is less than or equal to value. |
between | Cart value is between value and secondValue (both inclusive). |
Location operators
Section titled “Location operators”Test the destination country or province. Comparisons are case-insensitive.
| Operator | Passes when |
|---|---|
eq | The field matches value exactly. |
in | The field matches any value in the array. |
not_in | The field does not match any value in the array. |
Item operators
Section titled “Item operators”Test the vendor, product title or SKU of items in the cart. All comparisons are case-insensitive.
| Operator | Passes when |
|---|---|
eq | At least one item matches value exactly. |
contains | At least one item contains value as a substring. |
does_not_contain | No item contains value as a substring. |
starts_with | At least one item starts with value. |
does_not_start_with | No item starts with value. |
ends_with | At least one item ends with value. |
does_not_end_with | No item ends with value. |
in | At least one item matches any value in the array exactly. |
not_in | Every item in the cart does not match any value in the array. |
Matching semantics
Section titled “Matching semantics”AND logic between conditions. All conditions on a rule must pass for the rule to fire. There is no OR logic at the condition level. If you need OR-style behaviour, create separate rules.
“Some” vs “every” for item conditions. Positive item operators (eq, contains, starts_with, ends_with, in) pass if at least one item in the cart satisfies the test. Negative operators (does_not_contain, does_not_start_with, does_not_end_with, not_in) pass only if no item in the cart satisfies the inverse test. This means does_not_contain on a cart with two items passes only when neither item contains the value.