The Rule Builder included in Shopware 6 allows you to create individual rules based on conditions, which can be used, for instance, to calculate shipping costs or customer-specific product prices.
By accessing the menu item Settings > Shop > Rule Builder you will receive an overview of all rules that have already been created. The overview is divided into several columns that immediately show you the following information:
Name (1) Contains the name stored for the rule. For instance this name is used in the administration for assigning the rule in other modules
Description (2) Shows the (optional) description of the rule, including more information about the use of the rule, if applicable.
Priority (3) The priority indicates whether a rule is applied before another rule, if relevant. The higher the priority, the sooner it is executed.
Creation date (4) The rule was created on this date.
Status (4) Indicates whether the rule is valid, only valid rules can be used. Rules created through the administration are checked for validity and can only be saved if all mandatory fields are filled with valid values.
In this section we explain how to create rules and which conditions and operators you can use.
At the end you will also find various examples of common scenarios that you can use as a foundation for your own rules.
A rule consists of at least one condition, but can also contain several conditions which are connected by an AND / OR - link. Furthermore it's possible to add a subcondition.
When creating the condition, depending on the condition you select, various operators are available to define the condition in more depth. In order to create a new rule, click on the button Create rule.
Afterwards the following mask opens.
In the general settings of the rule you specify a name and set the priority of the rule.
With the priority you can define which rule should be executed first if there are several existing rules. These will be processed based on there priority. (A rule with priority 5 is executed before a rule with priority 3, but after a rule with priority 9)
Additionally, you can store a description text. For instance this could explain what this rule is used for.
This description is only displayed in administration and is not visible in the frontend.
You can specify the type of rule to make this rule available only in certain program modules, e.g. for shipping costs.
Most conditions are defined in more detail using additional operators.
The available operators vary between conditions and not all options are available for every condition.
The functions of each operator is explained below.
The following conditions are available
This condition always applies, a more detailed configuration is not necessary.
You can use the operators "Is one of" or "Is none of" for the billing country condition.
For the postcode of the billing address you can use the operators "Is one of" and "Is none of".
Example: 48612, 48624, 48683
You can use the operators "Is equal to" or "Is not equal to" for the billing street condition.
Example: Ebbinghoff 10
You can use this to check whether it is a business customer.
You can choose between the options "Yes" and "No".
Extensive options are available for checking the shopping basket value.
Please note that no currency is assigned to this condition.
If you want to link this to a currency, you can add another condition for currency linked by AND.
Check the number of previous orders of your customer.
Select the currency(ies) to be considered for these conditions.
The currencies which are defined under Settings > Currencies can be selected.
As operator you can choose between "Is one of" or "Is none of".
Example: Euro, Pound
With this condition, you can query the customer's e-mail address. The operators available to you are equal and not equal. You can either query exactly one address such as email@example.com or use "*" as a placeholder and query address ranges such as *@shopware.com.
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
With this condition you check whether the customer is currently logged in to the store or not. For example this can be used to offer logged in customers a special shopping experience that is unavailable for customers that are not logged in.
The customer number is available for a precise restriction.
Here you can choose between the operators "Is one of" or "Is none of".
Example: 12345, 23456
The Customer Tag condition allows you to check whether a customer is assigned a certain tag (keyword). For this purpose you can use the operators "Is one of" and "Is none of".
Example: Tag "VIP-Customer"
If you have created custom fields for customer, you can query their contents here. To do this, first select the custom field Set and the custom field it contains. Then you select Equal or Not equal and the value of the custom field.
Example: Text field and the value "Customer_with_special_properties".
The condition is valid within the set date range.
A distinction is made between the options "Including timestamp" and "Excluding timestamp".
You can use this to check for a weekday.
An exact definition is possible using the operators "Is equal to" and "Is not equal to".
Allows you to check how many days have passed since the customer's last order.
The condition Different Addresses refers to a delivery address that differs from the billing address, therefore the options "Yes" or "No" are available.
The system checks here whether the customer has selected the option "Delivery address differs from billing address".
Billing address - Sample street 123, 12345 Sample city
Delivery address - Test route 45, 45678 Test location
With the operators "Yes" and "No" you can check whether the shopping cart currently contains articles that are marked as free of shipping costs.
With the number of goods in the shopping cart, you can either simply check the total number of products in the shopping cart, or alternatively you can use much more extensive additional conditions.
There are several options available to you for checking the number..
The optional additional filters can be opened with the filter ;button (1) on the right side. A modal for the creation of the subordinate conditions will then open.
Possible subconditions are
The price of the goods in the shopping cart only adds up the prices of the products, no discounts, vouchers or shipping costs are taken into account.
Here you can also choose from a variety of operators
This gives you the option to check for new customers as a condition.
The options "Yes" and "No" are available for this purpose and you can thus, for instance, enable a payment method only for customers who have already ordered once in your shop.
Definition of a new customer:
A customer is declared as a new customer if the date of the first login matches the current date.
In addition to the customer number, you can also check for the customer last name.
You can use one of the options "Is equal to" or "Is not equal to".
Using the positions you can check certain products.
You can use the operators "Is one of" and "Is none of". Multiple selection of products is possible.
Example: Enormous Copper Cubicide
Here you can check whether the available stock of a position still corresponds to a certain value.
Allows you to check how many items are in the shopping cart.
There are also various options available.
There are various operators available to you for checking the height of a product. Note that the height always refers to a single product. A summation does not take place.
Using the operators "Is one of" and "Is none of" you can check whether a product is assigned to a certain category. The structure of the category tree is taken into account. So if you select a category here, the conditions also apply to the sub categories below.
Example: The category structure is "Catalog #1 > Food > Baked Goods". The product is assigned to the category Baked Goods. In the condition, we will check the category Food.
You can use this condition to determine if you want to check for new products.
The available operators for this are "Yes" and "No".
In order for a product to be marked as new, the publication date must be maintained and may not be more than 30 days old.
This allows you to check whether a position is a promoted. To manually promote a product, you can activate product promotion in the product settings.
You can choose between "Yes" and "No" as operators.
You can use this condition to check whether a product that is marked as promoted exists. The operators "Yes" and "No" are available for this purpose.
There are various operators available to you for checking the length of a product. Note that the length always refers to a single product. A summation does not take place.
Allows you to use the list price of a product as a condition.
Using the type of an item you can query whether a product or a discount or surcharge, e.g. in the shopping cart, is available.
You can use "Is equal to" and "Is not equal to" as operators.
Example: discount / surcharge
Using the operators "Is one of" and "Is none of" you can perform checks on product properties.
With this condition you can check the purchase price of products. The purchase price here refers to the price of a single product. There is no summation.
There are various operators available for the definition.
Here you can check whether a product is assigned to a certain tag. The operators "Is one of" and "Is none of" are available for configuring the condition. The tags are added in the product management. You can get further information here.
The total price of items refers to the total price of an item in the shopping cart. So if you put the same product into the shopping cart more than once, the price will be summed up in this condition.
The price of the positions refers to the price of a single product. There are various operators available for the comparison.
There are various operators available to you for checking the volume of a product. Note that the volume is calculated from length x width x height and that the volume always refers to a single product. A summation does not take place.
There are various operators available to you for checking the weight of a product. Note that the weight always refers to a single product. A summation does not take place.
To check the width of a product you can use various operators. Note that the width always refers to a single product. There is no summation.
To check if a line item with a certain attribute (value in a custom field) is included in the shopping cart, you can use this condition. Please note that only attributes that are configured for use in products can be selected.
For the configuration, first select the label (within a label, the individual custom fields are managed) that you want to query. Then you can select one of the custom fields contained in the label. Depending on the type of the custom field, different operators will be selected. Usually these are "Is equal to" and "Is not equal to". Finally, you define the value that should be checked.
Example: In the Shipping label, the custom field Shipping is of the type "Checkbox".
Here he checkbox only offers the operator "equal", because the exact check is done by whether the checkbox is checked or not.
Here you can check whether a product is marked as a sale. The operators "Yes" and "No" are available for this purpose.
Here you can check the date of creation. The date of creation refers to the time when the product was first created in the shop.
If you have created custom fields for products, you can query their contents here. To do this, first select the custom field Set and the custom field it contains. Then you select Equal or Not equal and the value of the custom field.
Example: Text field and the value "Heavy transport".
Allows you to check the quantity of a specific product in the shopping cart. For this purpose, you select the product that is to be queried. In addition, you then define an operator and the desired quantity.
Example: Product "Sleek Wool Wasabi Fresh" with the quantity 5
Enables you to query the publication date of the products.
You can check the tax rates of a product using the operators "Is one of" and "Is none of". Multiple selection is possible. You can select from already created tax rates in the system using the drop down list.
Here you can use the operators "Is one of" and "Is none of" to check whether a certain product is in the shopping cart.
Example: Synergistic Aluminium Mainstay
Enables the manufacturer's specification of the products to be reviewed.
Available options are "Is one of" and "Is none of". These two options allow a multiple selection.
Example: shopware AG
Use this condition to check whether a particular payment type is used. Do this by choosing between the operators "Is one of" and "Is none of". Select one or more of the existing payment methods from a drop down menu.
You can use this, for instance, to not offer payment methods together with certain shipping methods.
Select one or more of the existing sales channels here.
Additionally, you can choose between the operators "Is one of" or "Is none of".
Example: main shop
As a condition you can also check for the shipping country.
Here, you use "Is one of" or "Is none of" to define whether the countries deposited are evaluated if they match or if they do not match.
Example: Switzerland, USA
Use this condition to check whether a particular shipping type is involved. To do this, you choose from the operators "Is one of" and "Is none of". Then you can add one or more of the existing shipping methods from a drop down menu.
You can use this, for instance, to not offer shipping methods together with certain payment methods.
Example: Express shipping
Please note that this rule only works with full numeric postal codes.
In addition to shipping country and street, you can also check the shipping postal code. You can also use the operators "less than", "greater than", "greater than/equal to" and "less than/equal to".
The condition can be configured as either inclusion (Is one of) or exclusion (Is none of).
Example: 48612, 48624, 48683
It is also possible to use the shipping street as a condition.
Here you can choose between the operators "Is equal to" and "Is not equal to".
Example: Ebbinghoff 10
Here you define a time period in which the condition applies.
Example: 06:00 - 22:00
Check for the weight of the entire shopping cart.
Within a rule, you can link several conditions with each other, which allows you to map even very complex scenarios.
In the case of an AND link, all conditions must apply for the rule to be considered valid.
Avoid querying the same resource in both conditions of an AND operation, as this can lead to problems in the evaluation of the condition.
Only one of the conditions has to match for an OR link to be valid.
You also have the option of creating subconditions. In this case, the system first checks the parent condition and if this is met, the system checks the subcondition(s).
For better understanding we have created an article with some examples in the Tutorials & FAQ section.
Rules can only be deleted if they are no longer used by the system. If you want to delete a rule that is still being used by the system, you will get a message telling you where in the system the selected rule still exists. For example, in the products, shipping costs or in a promotion.
According to this error message, the rule is still used in two shipping types and one discount promotion. You can click on the link and you will be taken directly to the place where the rule is still used.