The Rule engine is a powerful tool that makes it possible to adapt your Checkout configuration to your needs. Using the Rule engine you can set up conditions for most delivery options, services and addons to decide what alternatives to show in your checkout based on parameters such as weight, cart price, and destination.
This article will show you how to set up the following use cases:
- Price: If the cart contains items for EUR 50 or more the delivery is free of charge
- Weight: This delivery option should only be shown if the weight of the parcel is less than 20 kg
- Date range: Delivery is free from Christmas Eve to December 27th
Price
If the shopping cart contains items for EUR 50 or more the delivery is free of charge.
- Go to Parameters in the sidebar menu and select cart_price from the drop-down list. Only activated parameters will be available for use in the Rule engine.
- Next, go to Rule engine and click Add new rule.
- Enter a name, e.g. "Free shipping". Activate the rule using the toggle switch in the top right corner.
- Add the Conditions. In this example, the conditions say "if the cart price is greater than or equal to 50".
- Next, specify the Actions that should happen when the conditions are met. In this example, we set the price of the selected carrier service to 0.
- Click Continue and Save.
Weight
The specified delivery options should only be shown if the weight of the parcel is less than 20 kg
- Go to Parameters in the sidebar menu and select weight_kg from the drop-down list. Only activated parameters will be available for use in the Rule engine.
- Next, go to Rule engine and click Add new rule.
- Enter a name describing what the rule does. Activate the rule using the toggle switch in the top right corner.
- Add the Conditions. In this example, the conditions say "if the weight is greater than or equal to 20 kg".
- Next, specify the Actions that should happen when the conditions are met. In this example, we want the PostNord delivery options to be disabled.
- Click Continue and Save.
Date range
Delivery is free from Christmas Eve to December 27th.
- Go to Parameters in the sidebar menu and select time from the drop-down list. Only activated parameters will be available for use in the Rule engine.
- Next, go to Rule engine and click Add new rule.
- Enter a name describing what the rule does. Activate the rule using the toggle switch in the top right corner.
- Add the Conditions. In this example, the conditions say "if date is greater than or equal to 24-12-24 and date is less than or equal to 24-12-27".
- Next, specify the Actions that should happen when the conditions are met. In this example, we set the price of all our delivery options to 0.
- Click Continue and Save.
Additional use cases
Example 1:
You want to offer free shipping on orders of at least 50 EUR. If the shopping cart is less than 50 EUR, a text saying how much more the customer needs to add to get free shipping should be displayed.
This is set up by creating two rules.
Conditions: If cart_price is less than 50
Actions: Set text Delivery Option -> Shop for an additional {50-cart_price} EUR and receive free shipping
Conditions: If cart_price is greater than or equal to 50
Actions: Set price Delivery Option
Example 2:
You have a loyalty program on your website and want to offer a free delivery option to VIP customers.
We have created a boolean custom parameter called "vip" for this rule. This will be set to true if a customer is registered with the loyalty program.
Conditions: IF vip is equal to True
Actions: Set price Delivery Option 0 EUR
Example 3:
You are running a New Year's campaign and offer free shipping on all orders made on December 31. A campaign text on the free delivery option should also be displayed on this date.
Conditions: If date is equal to 24-12-31
Actions: Set price Delivery option -> 0 EUR. Set text Delivery option - > Field 1
Example 4:
You have a carrier that only delivers in the Copenhagen area so that delivery option should only be shown if the receiver country is Denmark and the postcode range is 1000-2800.
Conditions: If to_country is not equal to Denmark
Actions Set enabled Delivery Option -> False
Conditions: If to_postal_code is less than 1000 Or to_postal_code is greater than 2800
Actions: Set enabled Delivery Option -> False
Example 5:
You have a delivery option that should only be available for orders to Sweden and should not show if the parcel's weight exceeds 20 kg.
Conditions: If weight_kg is greater than or equal to 20 and to_country is not equal to Sweden
Actions: Set enabled Delivery Option -> False.