What are rules?
Rules are added to rates to make adjustments the shipping cost or to hide or show a rate based on conditions.
There are 5 rule types to pick from:
- Set rate to free or fixed cost
- Add to ship cost
- Subtract from ship cost
- Hide rate when…
- Only show rate when...
Rules can be used on all rate types — both rule based rates and carrier rates. The possibilities with rules are endless. Below are are some examples…
Examples:
Set rate to Free Shipping when product price is over $100 and weight is under 50lbs.
Add 2% of product price to a rate when total price is over $1000 ( Insurance )
Offer 20% discount on a rate when Name on the shipping address is ‘George Washington’ or ‘Abraham Lincoln’ and address is the White House
Hide an express shipping rate when there are hazardous goods
Only show a rate when the weight total is over 150lbs and Company Name is ‘Shopify’ or ‘Advanced Shipping Rules’
How to Add/Edit/Delete a Rule
To add a rule, you need to first create a rate or edit an existing rate. At the bottom of every rate's edit or add page, there is a section labeled Rules.
- Navigate to the bottom of a rate, and find the section Rules
- Choose a rate type from the dropdown menu
- Click Add Rule
- Configure your rule
- Save the rule
To edit a rule, click ‘Edit’
To delete a rule, click ‘Delete’
Rule Order
Rules get executed in the order they appear.
So let’s say you have a rate that is a flat rate of $10.
If you have rules in this order:
- Add $5 to ship cost
- Set rate to free shipping over $100
And the total price is $150, the rate will be free.
If you have rules in this order:
- Set rate to free shipping over $100
- Add $5 to ship cost
And the total price is $150, the rate will be $5
You can drag and drop rules to set their sort order.
Click the little dots icon on the left side of the rule, hold down, and drag the rule up or down to set the order.
Set rate to free or fixed cost
This option requires at least one condition.
Free Shipping
This option will set the rate to $0 ( Free Shipping ) based on the condition(s) configured.
Fixed Cost
This option will set the rate to the value you specify based on the condition(s) configured.
Add to ship cost / Subtract from ship cost
The Add to / Subtract from rules can either apply Always ( for a consistent mark-up on a carrier rate ) or When... gives you the ability to add conditions as to when the addition or subtraction should occur.
The kind of values that can be added or subtracted are as follows:
Flat Amount
The amount specified will be added to or subtracted from the rate.
Flat Amount Per Item
This option will apply the amount specified times total QTY of items from the group.
Flat Amount Per Package
This option only applies to carrier rates. The amount specified will be added to or subtracted from the rate times the number of packages used in the rate calculation as defined by the package settings.
Percent of Product Total
This option will add or subtract a percentage of the combined price of all products from the product group belongs to. So if the the total price of all products from the group is $100.00 and the value set is 10% it will add or subtract $10.00 from the rate.
Percent of Ship Cost
This option will add or subtract a percentage the price of the rate. So if the ship cost outputted by the rate is $10 and the value set is 10% it will add or subtract $1.00 from the rate. Think of this as mark-up or a discount on the rate.
Hide rate when… / Only show rate when…
These rule types don’t take any values, they only take conditions. Based on the conditions configured, the rate will either be hidden or only showed depending on the conditions you configure.
- If a rate is 'Hide rate when...' it means it will not appear at checkout when the conditions within it are met.
- If a rate is ‘Only show when…’, it means it will only appear at checkout when the conditions within are met.
Implications for Blended Rates
These rules have implications when it comes to Blended Rates.
If you choose a rate that has a hide/show rule applied as a preferred rate within a blended rate, and the rate is hidden, the blended rate will fail. If you don’t want the blended rate to fail you can set a rate priority to offer back-up preferred rates, learn more about setting rate priority in a blended rate.
Conditions
Conditions determine when to apply a rule to a rate.
When there are multiple conditions within a rule, all conditions must be true for the rule to be applied.
In that sense, multiple conditions within a rule function like an AND statement.
Let’s take the following example:
Set rate to free shipping when the price of all products from this group is over $100 AND the total weight of all products from this group is under 10lbs.
In order for free shipping to be applied, the both conditions need to be true. If just one condition is true, free shipping will not be applied. So if the combined price is $200 but the weight is 20lbs, free shipping would not be applied.
If you want to apply rule under multiple conditions that function like an OR statement, then you need to create multiple rules with different conditions.
Set rate to free shipping when the price of all products from this group is over $100 OR the total weight of all products from this group is under 10lbs.
In this example, instead of having one rule with two conditions, there are two separate rules each with one condition.
Variables
Product Variables (Interger)
- Quantity
- Weight
- Price
The key thing to pay attention to when using conditions that use the Quantity, Weight, or Price variables is the way you target products those variables belong to.
You can target all, any, or each product from either the product group that the rate/rule belongs to, or all, any, or each product from the entire order.
In the majority of cases you should be choosing ‘...from this group’, because it is counting only the products that are used in the rate’s calculation.
of all products from this group
The combined total values of all the products in the group are targeted.
‘When the price of all the products from this group equals $10’, means the combined price of all the products from the product group must be greater than $10.
of any product from this group
Any single product with a matching value in the group is targeted.
‘When the price of any product from the group equals $10’, means if any one single product from the group within an order has a set price of $10. If there are 5 products and at least one product has a price of $10, the condition is true.
of each product from this group
Each and every individual value of a single product in the group is targeted.
‘When the price of each product from the group equals $10’, means if each and every single product from the group within an order has a price of $10. If there are 5 products and 4 of them have a price of $10 and one of them does not, then the condition is not true.
of all products in the entire order, of any product in the entire order, of each product in the entire order
They follow the same logic above, but instead of targeting only the products that belong to the group the rate/rule is added to, it will target all products in the entire order even if they are from other groups that the rate/rule is not applied to.
Product Variables ( String )
- Title
- SKU
- Vendor
These variables with target a string of characters from a product’s Title, SKU, or Vendor field.
of any product from this group
Only one product in an order from the product group need to the match the condition specified.
of each product from this group
Each and every product in an order from the product group needs to the match the condition specified.
of any product in the entire order, of each product in the entire order
Instead of looking at just products from the product group the rate/rule belongs to, it will look at all products in the entire order, even if the products are from other groups.
Use comma separated values
In the screenshot example above, multiple values are used separated by commas. This will target products with titles that contain ‘apple’, ‘orange’, ‘banana’, or ‘fruit’. A product title only needs to contain one of the values to be counted in the condition.
This is how the rule reads when you use comma separated values like in the one above.
Address Variables ( Strings )
- Name
- Company Name
- Address
- Address 2
- City
- State
- Postal Code
- Country
- Phone
Address variables let you target the values of a customers shipping address.
Use comma separated values
This will target shipping addresses when the city name ‘New York’, ‘Manhattan’, ‘Brooklyn’, ‘Queens’, ‘Bronx’ or ‘Staten Island’.
Use the 'starts with' option to target a range of zip codes
This will target zip codes starting with 11.... So 11211, 11222, 11262, etc.
String variable targeting
- equals
- is not equal to
- contains
- does not contain
- starts with
- does not start with
- ends with
- does not end with
When specifying string variables ( whether a single variable, or a comma separated list of variables ) you can use highly flexible comparisons options to target values with.