You are currently viewing the article on an older Shopware version!
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
Always valid
This condition always applies, a more detailed configuration is not necessary.
Billing country
You can use the operators "Is one of" or "Is none of" for the billing country condition.
Example: Canadeda
Billing postal code
For the postcode of the billing address you can use the operators "Is one of" and "Is none of".
Example: 48612, 48624, 48683
Billing street
You can use the operators "Is equal to" or "Is not equal to" for the billing street condition.
Example: Ebbinghoff 10
Business customer
You can use this to check whether it is a business customer.
You can choose between the options "Yes" and "No".
Example:
Cart amount
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.
Example: 49,99
Count of orders
Check the number of previous orders of your customer.
Example: 5
Currency
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
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 logged in
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.
Example:
Customer number
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
Customer Tag
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"
Date range
The condition is valid within the set date range.
A distinction is made between the options "Including timestamp" and "Excluding timestamp".
Day of the week
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".
Example: Wednesday
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 the options "Yes" or "No" are available.
The system checks here whether the customer has selected the option "Delivery address differs from billing address".
Example:
Billing address - Sample street 123, 12345 Sample city
Delivery address - Test route 45, 45678 Test location
Free shipping
With the operators "Yes" and "No" you can check whether the shopping cart currently contains articles that are marked as free of shipping costs.
Goods count
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..
Example: 10
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
Goods price
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
Example: 49,99
Is new customer
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.
Last name
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".
Example: Müller
Line item
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
Line item count in cart
Allows you to check how many items are in the shopping cart.
There are also various options available.
Example: 8
Line item height
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.
Example: 350
Line item in category
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.
Line item is new
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.
Example:
Line item is promoted/ highlighted
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.
Line item is promoted
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.
Example:
Line item length
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.
Example: 475
Line item list price
Allows you to use the list price of a product as a condition.
Example: 15
Line item of type
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
Line item property
Using the operators "Is one of" and "Is none of" you can perform checks on product properties.
Example: XL
Line item purchase price
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.
Example: 20,00
Line item tag
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.
Example: Testtag1
Line item total price
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.
Example: 50,00
Line item unit price
The price of the positions refers to the price of a single product. There are various operators available for the comparison.
Example: 30.00
Line item weight
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.
Example: 5
Line item width
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.
Example: 750
Line item with attribute
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 additional 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.
Line item with clearance sale
Here you can check whether a product is marked as a sale. The operators "Yes" and "No" are available for this purpose.
Line item with creation date
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.
This condition is currently not yet available and will be provided with one of the upcoming updates.
Line item with custom field
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".
Line item with quantity
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
Line item with release date
Enables you to query the publication date of the products.
This condition is currently not yet available and will be provided with one of the upcoming updates.
Line item with tax rate
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.
Line items in cart
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
Manufacturer
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
Payment method
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.
Example: Invoice
Sales channel
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
Shipping country
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
Shipping method
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
Shipping postal code
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
Shipping street
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
Time range
Here you define a time period in which the condition applies.
Example: 06:00 - 22:00
Weight of cart
Check for the weight of the entire shopping cart.
Example: 2,0
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.
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.
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.
Example:
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.