You are currently viewing the article on an older Shopware version!
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.
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.
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.
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.
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.
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
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
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
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
Count of orders
You can use this to check how many orders the customer has already placed in your shop.
Example: 10
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
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
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
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".
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
Days since last order
Allows you to check how many days have passed since the customer's last order.
Example: 10
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
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
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
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
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
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
Line item unit price
Allows you to check the price of a line item
Example: 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
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
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.
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
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
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
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
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
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.
Shipping street
The operators "Equal" or "Not equal" are available to you for the shipping street condition.
Example: 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
Time range
You use this to define a period in which the condition applies.
Weight of cart
Checking the weight of the cart
Example: 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).
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 products, Total quantity of distinct products, as well as Subtotal of all items.