You are currently viewing the article on an older Shopware version!

Rule builder

Using the Rule Builder included in Shopware 6, you can create individual rules based on conditions that can be used, for example, to calculate shipping costs or customer-specific product prices.

Overview


When you open the menu item Settings > Shop > Rule builder you get an overview of all rules already created. The overview is divided into several columns, which provide you with the following information:

  • Name (1) Contains the name stored for the rule. This name is used, for example, in administration for assigning the rule in other modules.

  • Description (2) Shows the (optional) description of the rule, which may contain more information about the use case.

  • Priority (3) The priority specifies whether a rule is applied before another rule if necessary. The higher the priority, the more likely it is to be executed.

  • Creation date (4) The rule was created on this date.

  • Status (4) Specifies whether the rule is valid and can be used. Rules created via administration are checked and can only be saved if all mandatory fields are filled with valid values.

Create rule

We show you how to create rules and which conditions and operators are available to you.
At the end you will also find various examples of common scenarios that you can use as a basis for your own rules.

A rule consists of at least one condition, but can also contain several conditions that are linked by an AND / OR relationship. It is also possible to add a sub-condition.

When you create a condition, various operators are available to you, depending on the condition, in order to be able to define them more closely.

To create a new rule, click the Create rule button.
Then the following mask opens.

General

In the general settings of the rule you define a name and the priority of the rule.

You can use the priority to define which rule should be executed first for several existing rules. The higher the value compared to the other rules, the more likely the rule will be executed. (A rule with priority 5 is executed before a rule with priority 3, but after a rule with priority 9.)

In addition, you can store a description text to explain, for example, what this rule is used for.
This description is only displayed in the administration and is not visible in the frontend.

You can also specify the type of rule to make this rule only available in certain modules, e.g. for shipping costs.

Operators

Most conditions are defined in more detail using an additional operator.

The available operators vary between conditions and not all options are available for every condition.

In the following we will first explain the function of the individual operators

  • Equals
    The condition applies if the stored value is the same as the input.

Ist hier jeweils nur ein Eintrag möglich oder können mehrere Werte getrennt hinterlegt werden?
Wenn mehrere Werte hinterlegt werden können, wie werden diese getrennt, wenn diese nicht aus einer Liste ausgewählt werden können?

  • Not equals
    The condition applies if the stored value differs from the specification.

  • Is one of
    The condition applies if one of the stored values matches the specification.

  • Is none of
    The condition applies if none of the stored values matches the specification.

  • Greater
    The condition applies if the corresponding value is greater than the value defined here.

  • Greater than equals
    The condition applies if the corresponding value is equal to or greater than the value defined here..

  • Lower
    The condition applies if the corresponding value is less than the value defined here.

  • Lower than equals
    The condition applies if the corresponding value corresponds to or is less than the value defined here.

Conditions

The following conditions are available

Billing country
As a condition, you can also check the billing country.
Also here you can define via "Is one of" or "Is none of" whether the deposited countries will be evaluated if there is a match or if the countries do not apply.

Example: Switzerland, USA

  • Is one of
    This condition applies if Switzerland or the USA are deposited as the billing country.
  • Is none of
    The condition is fulfilled if the invoicing country is not Switzerland or USA.


Billing street
It is also possible to use the billing street as a condition.
Here you can choose between the operators "Equal" and "Not equal".

Example: Ebbinghoff 10

  • Equals
    The condition applies if Ebbinghoff 10 is stored as the billing street.
  • Not equals
    The condition is fulfilled if the billing street is not Ebbinghoff 10.


Billing zip code
In addition to the billing country and street, you can also check the billing address postal code.
The condition can be configured as either Include (Is one of) or Exclude (Is none of).

Example: 48612, 48624, 48683

  • Is one of
    The condition applies if the postal code of the billing address is 48612, 48624 or 48683.
  • Is none of
    The condition applies if the postal code of the billing address is not 48612, 48624 or 48683.


Cart amount
Extensive options are available for checking the cart amount.
Please note that no currency is assigned to this condition.
If you want to link this to a currency in addition, you can add another currency condition linked by AND.

Example: 49.99

  • Equal
    The condition is fulfilled if the cart amount is exactly 49.99.
  • Greater
    The condition is fulfilled if the cart amount is greater than 49.99.
  • Greater than equals
    The condition is fulfilled if the cart amount is 49.99 or more.
  • Lower
    The condition is fulfilled if the cart amount is less than 49.99.
  • Lower than equals
    The condition is fulfilled if the cart amount is 49.99 or less.
  • Not equals
    The condition is fulfilled if the cart amount does not correspond to 49.99.


Count of orders
You can use this to check how many orders the customer has already placed in your shop.

Example: 10

  • Equals
    The condition is fulfilled if the customer has placed 10 orders.
  • Greater
    The condition is fulfilled if the customer has placed more than 10 orders.
  • Greater than equals
    The condition is fulfilled if the customer has placed 10 orders or more.
  • Lower
    The condition is fulfilled if the customer has placed less than 10 orders.
  • Lower than equals
    The condition is fulfilled if the customer has placed 10 orders or less.
  • Not equals
    The condition is fulfilled if the customer has not placed 10 orders.


Currency
Select the currency(s) to be considered for these conditions.
The currencies defined under Settings > Currencies can be selected.
As operator you choose between "Is one of" or "Is none of".

Example: Euro, Pound

  • Is one of
    The condition is valid if the currency used is Euro or Pound.
  • Is none of
    The condition applies if the selected currency is not Euro or Pound.


Customer group
If you use the customer group as a condition, you can choose between the two extended operators "Is one of" and "Is none of".

Example: Net price customer group

  • Is one of
    The condition is fulfilled if the customer is assigned to the net price customer group.    
  • Is none of
    The condition applies if the customer is assigned to a different customer group than the net price customer group.


Customer number
The customer number is available for an exact restriction.
Here you can choose between the operators "Is one of" or "Is none of".

Example: 12345, 23456

  • Is one of
    The condition applies if the customer has one of the customer numbers 12345 or 23456.
  • Is none of
    If the customer does not have one of the customer numbers 12345 or 23456, this condition applies.


Date range
The condition is valid within the set date range.
A distinction is made between the options "Use time" and "Don't use time".

Example: 2019-05-23 (06:00) - 2019-05-31 (22:00)
  • Don't use time: Only a start date and an end date are selected here.
    The condition is valid from 23.05.2019 up to and including 31.05.2019.
  • Use time: In addition to the date, the time is also specified.
    The condition is valid from 23.05.2019 06:00 to 31.05.2019 22:00.


Day of the week

You can use this to carry out an evaluation for a weekday.
An exact definition is possible via the operators "Equal" and "Unequal

Example: Thursday

  • Equals
    The condition is fulfilled if the current day of the week is Thursday.
  • Not equals
    The condition is fulfilled if the current day of the week is not Thursday.


Days since last order
Allows you to check how many days have passed since the customer's last order.

Example: 10

  • Equals
    The condition is fulfilled if exactly 10 days have passed since the last order.
  • Greater
    The condition is fulfilled if more than 10 days have passed since the last order.
  • Greater than equals
    The condition is fulfilled if 10 or more days have passed since the last order.
  • Lower
    The condition is fulfilled if less than 10 days have passed since the last order.
  • Lower than equals
    The condition is fulfilled if 10 or less days have passed since the last order.
  • Not equals
    The condition is fulfilled if not 10 days have passed since the last order.


Different addresses
The condition Different addresses refers to a delivery address that differs from the billing address, therefore "Yes" or "No" are available as options.
The system checks whether the customer has activated the option "Delivery address differs from billing address".

Example:
billing address - Musterstraße 123, 12345 Musterstadt
delivery address - Testweg 45, 45678 Testort

  • Yes
    The condition applies because the billing and delivery address are different.
  • No
    The condition does not apply because the billing and delivery address are different.


Goods count
You can either simply check the total count of goods in the cart, or alternatively you can use much more extensive additional terms.

Various opterators are available

Example: 10

  • Equals
    The condition is fulfilled if there are 10 products in your cart.
  • Greater
    The condition is fulfilled if there are more than 10 products in your cart.
  • Greater than equals
    The condition is fulfilled if there are 10 or more products in your cart.
  • Lower
    The condition is fulfilled if there are less than 10 products in your cart.
  • Lower than equals
    The condition is fulfilled if there are 10 or less products in your cart.
  • Not equals
    The condition is fulfilled if there are not 10 products in your cart.


You open the optional additional filters via the filter button (1) on the right side, a modal for the creation of the subordinate conditions will then open.


Possible subconditions are

Line item
You can use the operators Is one of and Is none of to check whether a certain product is contained in the shopping cart.

Example: Synergistic Aluminum Mainstay

  • Is one of
    The condition is fulfilled if the product "Synergistic Aluminum Mainstay" is in the cart.
  • Is none of
    The condition is fulfilled if the product "Synergistic Aluminum Mainstay" is not in the shopping cart.

  • Line item of type

Here you can check the different types of positions. The possible types are "Product" or "Discount / surcharge". Thus you can e.g. create a condition which is only valid if no discounts are applied to the current shopping cart.
Operators "Equals" and "Not equals" are at your disposal.

Example: Discount / surcharge

  • Equals
    The condition is fulfilled if an item of type Discount / surcharge is contained.
  • Not equals
    The condition is fulfilled if no item of type Discount / surcharge is contained.


Line item tag
This can be used to check for items in the cart that have a specific tag.
These tags can be created and added when you create a product, for example.
The operators available are Is one of and Is none of.

Example: SCD2019

  • Is one of
    The condition applies if the product has the tag "SCD2019" assigned to it.
  • Is none of
    The condition applies if the product is not assigned the tag "SCD2019"


Line item total price
In contrast to the goods price, the line item total price also includes discounts, vouchers and shipping costs.
Various operators are available for the exact definition.

Example: 49.99

  • Equals
    The condition is fulfilled if the line item total price is exactly 49.99.
  • Greater
    The condition is fulfilled if the line item total price is greater than 49.99.
  • Greater than equals
    The condition is fulfilled if the line item total price is 49.99 or more.
  • Lower
    The condition is fulfilled if the line item total price is less than 49.99.
  • Lower than quals
    The condition is fulfilled if the line item total price is 49.99 or less.
  • Not equals
    The condition is fulfilled if the line item total price is not 49.99.


Line item unit price
Allows you to check the price of a line item

Example: 49.99

  • Equals
    The condition is fulfilled if the line item unit price is exactly 49.99.
  • Greater
    The condition is fulfilled if the line item unit price is greater than 49.99.
  • Greater than equals
    The condition is fulfilled if the line item unit price is 49.99 or more.
  • Lower
    The condition is fulfilled if the line item unit price is less than 49.99.
  • Lower than quals
    The condition is fulfilled if the line item unit price is 49.99 or less.
  • Not equals
    The condition is fulfilled if the line item unit price is not 49.99.


Line item with quantity
With this condition you have the possibility to check whether a certain quantity of a certain product is stored in the cart.
Three fields are available for this purpose.
In the first field you select the product, then the operator "equal" or "unequal" and finally the quantity to be checked.

Example:
Item: Synergistic Aluminum Mainstay
Quantity: 5

  • Equals
    The condition is fulfilled if the product Synergistic Aluminum Mainstay is added to the cart 5 times.
  • Not equals
    The condition is fulfilled if the product Synergistic Aluminum Mainstay is not added 5 times to the cart.


Goods price
In the total price of the cart products, only the prices of the products are added together, no discounts, vouchers or shipping costs are taken into account.
You can choose from a variety of operators

Example: 49.99

  • Equals
    The condition is fulfilled if the total price of the cart products is exactly 49,99.
  • Greater
    The condition is fulfilled if the total price of the cart products is greater than 49.99
  • Greater than equals
    The condition is fulfilled if the total price of the cart products is 49.99 or more.
  • Lower
    The condition is fulfilled if the total price of the cart products is lower than 49.99
  • Lower than equals
    The condition is fulfilled if the total price of the cart products is 49.99 or less.
  • Not equals
    The condition is fulfilled if the total price of the cart products is not 49.99.


Is new customer
This gives you the opportunity to check for new customers as a condition.

The options "Yes" and "No" are available for this purpose and you can, for example, only release a payment method for customers who have already ordered in your shop.

Definition of new customer:
As a new customer, a customer is declared who has not yet been logged in and for whom the date of the first login is the same as today's date.

  • Yes
    The condition applies if the customer is a new customer.
  • No
    If the customer is not a new customer, this condition applies.


Last name
In addition to the customer number, you can also check for the customer last name.
For this you can use one of the operators "Equal" or "Not equal".

Example: Miller

  • Equal
    The condition is fulfilled if a customer is logged in with the surname Miller.
  • Not equal
    The condition applies when a customer not named Miller is logged in.


Line item count in cart
Allows you to check how many line items are in the cart.
There are also various options available.

Example: 10

  • Equals
    The condition is fulfilled if there are 10 line items in the cart..
  • Greater
    The condition is fulfilled if there are more than 10 line items in the cart.
  • Greater than equals
    The condition is fulfilled if there are 10 or more line items in the cart.
  • Lower
    The condition is fulfilled if there are less than 10 line items in the cart.
  • Lower than quals
    The condition is fulfilled if there are 10 or less line items in the cart.
  • Not equals
    The condition is fulfilled if there are not 10 line items in the cart.


Line item in cart
You can use the operators Is one of and Is none of to check whether a certain product is contained in the cart.

Example: Synergistic Aluminum Mainstay

  • Is one of
    The condition is fulfilled if the product "Synergistic Aluminum Mainstay" is in the cart.
  • Is none of
    The condition is fulfilled if the product "Synergistic Aluminum Mainstay" is not in the shopping cart.


Sales channel
Select one or more from the existing sales channels.
Additionally you can choose between the operators "Is one of" or "Is none of".

Example: Main shop

  • Is one of
    This condition only applies if the Sales Channel main shop is used.    
  • Is none of
    This condition applies if the Sales Channel main shop is not used.


Shipping country
Just as you can check the billing address data, the information from the shipping address is also available to you.
For the shipping country, you define the condition using the operators "Is one of" or "Is none of".

Example: Switzerland

  • Is one of
    The condition is fulfilled if Switzerland is indicated as the country of shipping.
  • Is none of
    The condition applies if a shipping country other than Switzerland has been selected.


Shipping free product
Using the operators "Yes" and "No" you can check whether there are currently articles in the cart that are marked as free of shipping costs.

  • Yes
    The condition is fulfilled if there are free shipping items in the cart.
  • No
    The condition is fulfilled if there are no free shipping items in the cart.    


Shipping street
The operators "Equal" or "Not equal" are available to you for the shipping street condition.

Example: Ebbinghoff 10

  • Equals
    The condition applies if Ebbinghoff 10 is defined as the shipping street.
  • Not equals
    The condition is fulfilled if the shipping street is not Ebbinghoff 10.


Shipping zip code
For the postal code of the shipping address you can use the operators "Is one of" and "Is none of".

Example: 48612, 48624, 48683

  • Is one of
    The condition applies if the postal code of the delivery address is 48612, 48624 or 48683.
  • Is none of
    The condition applies if the postal code of the delivery address is not 48612, 48624 or 48683.


Time range
You use this to define a period in which the condition applies.

Example: 06:00 - 22:00
  • The condition is valid between 06:00 and 22:00.


Weight of cart
Checking the weight of the cart

Example: 2.0

  • Equals
    The condition is fulfilled if the weight of cart is exactly 2.0.
  • Greater
    The condition is fulfilled if the weight of cart price is greater than 2.0.
  • Greater than equals
    The condition is fulfilled if the weight of cart price is 2.0 or more.
  • Lower
    The condition is fulfilled if the weight of cart price is less than 2.0.
  • Lower than quals
    The condition is fulfilled if the weight of cart price is 2.0 or less.
  • Not equals
    The condition is fulfilled if the weight of cart price is not 2.0.

Within a rule, you can link several conditions with each other, which makes it possible for you to depict even very complex scenarios.
In the case of an AND connection, all conditions must apply for the rule to be fulfilled.
Only one of the conditions must match in order for an OR link to be fulfilled. 
You also have the option to create subconditions. The system first checks the upper condition, and if this is fulfilled, it checks the lower-level condition(s).

Additional Filter

In certain cases, a filter function is available in addition to the conditions. These additional filters enable you to define the items that must fulfill the relevant condition. To define a filter, click on the filter button (1) on the right side of your condition. A modal then opens for the creation of the subordinate conditions.  The following conditions have the filter option: Total quantity of all productsTotal quantity of distinct products, as well as Subtotal of all items

Was this article helpful?