Rule builder

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.

Overview

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.

Create rule

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.

General

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.

Operators

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.

  • Is Equal to
    The condition applies if the stored value is equal to the value entered.
  • Is not Equal to
    The condition applies if the stored value is not equal to the value entered.
  • 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 match the specification.
  • Is greater than
    The condition is met if the corresponding value is greater than the value defined here.
  • Is greater than / equal to
    The condition is met if the corresponding value is equal to or greater than the value defined here.
  • Is less than
    The condition is met if the corresponding value is less than the value defined here..
  • Is lower than / equal to
    The condition is met if the corresponding value is equal to or smaller than the value defined here.

Conditions

The following conditions are available

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

  • Yes
    This condition applies because the billing and delivery address are different
  • No
    This condition does not apply, as the billing and delivery address are the same.

Count of orders

Check the number of previous orders of your customer.

Example: 5

  • Is equal to
    The condition is met if the customer has placed 5 orders so far..
  • Is greater than
    The condition is met if the customer has placed more than 5 orders so far.
  • Is greater than / equal to
    The condition is met if the customer has previously placed 5 or more orders..
  • Is less than
    The condition is met if the customer has placed less than 5 orders so far.
  • Is lower than / equal to
    The condition is met if the customer has placed 5 or less orders so far.
  • Is not equal to
    The condition is met if the customer has placed any number of orders other than 5.

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

  • Is equal to
    The condition is met if there are 10 goods in the shopping cart.
  • Is greater than
    The condition is met if there are more than 10 goods in the shopping cart.
  • Is greater than / equal to
    The condition is met if there are 10 or more goods in the shopping cart.
  • Is less than
    The condition is met if there are less than 10 goods in the shopping cart.
  • Is lower than / equal to
    The condition is met if there are 10 or less goods in the shopping cart.
  • Is not equal to
    The condition is met for any number of goods other than 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

  • Manufacturer
  • Line item is new
  • Line item of type
  • Line item
  • Line item purchase price
  • Line item total price
  • Line item unit price
  • Line item in category
  • Line item with clearance sale
  • Line item count in cart
  • Line item width
  • Line item property
  • Line item with release date
  • Line item with creation date
  • Line item weight
  • Line item height
  • Line item length
  • Line item with tax rate
  • Line item list price
  • Line item tag
  • Line item is promoted

Date range

The condition is valid within the set date range.
A distinction is made between the options "Including timestamp" and "Excluding timestamp".

Example: 2019-05-23 (06:00) - 2019-05-31 (22:00)
  • Including timestamp: Both the date and the time are being taken into account.
    The condition is valid from 23.05.2019 06:00 until 31.05.2019 22:00.
  • Excluding timestamp: Only a start and an end date are selected here.
    The condition is valid from 23.05.2019 up to 31.05.2019.

Business customer

You can use this to check whether it is a business customer.
You can choose between the options "Yes" and "No".

Example:

  • Yes
    The condition is met if the client is a business customer.
  • No
    The binding is met if the customer is not a business customer.

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

  • Is one of
    The condition is met if the manufacturer is shopware AG.
  • Is none of
    The condition is met if the manufacturer is not shopware AG.

Always valid

This condition always applies, a more detailed configuration is not necessary.

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 met if the customer is assigned to the net price customer group.
  • Is none of
    The condition is met if the customer is not assigned to the net price customer group.

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

  • Is one of
    This condition applies if it is one of the customers with the customer number 12345 or 23456.
  • Is none of
    This condition applies if the customer does not have one of the customer numbers 12345 or 23456.

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

  • Is one of
    This condition applies if the postcode of the billing address is 48612, 48624 or 48683.
  • Is none of
    This condition applies if the postcode of the billing address is not 48612, 48624 or 48683.

Billing country

You can use the operators "Is one of" or "Is none of" for the billing country condition.

Example: Cananda

  • Is one of
    The condition is met if Canada is specified as the billing country.
  • Is none of
    This condition applies if a billing country other than Canada has been selected.

Billing street

You can use the operators "Is equal to" or "Is not equal to" for the billing street condition.

Example: Ebbinghoff 10

  • Is equal to
    This condition applies if Ebbinghoff 10 is stored as billing street.
  • Is not equal to
    This condition applies if Ebbinghoff 10 is not stored as billing street.

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

  • Is equal to
    The condition is met if a customer is logged in with the surname Müller.
  • Is not equal to
    The condition is met if a customer is logged in with a different surname than Müller.

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.

  • Yes
    This condition is met if the customer is a new customer.
  • No
    This condition is met if the customer is a returning customer.

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:

  • Yes
    The condition is met if at least one of the queried products is declared as new.
  • No
    The condition is met if no product from the query is considered new.

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

  • Is equal to
    The condition is met if there is at least one item with a discount or surcharge.
  • Is not equal to
    The condition is met if there is no item with a discount or surcharge.

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

  • Is one of
    This condition applies to the product 'Enormous Copper Cubicide.
  • Is none of
    The condition is met if the product "Enormous Copper Cubicide" is not included in the query.

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

  • Is equal to
    The condition is met if the purchase price is exactly 20.00.
  • Is greater than
    The condition is met if the purchase price is over 20.00.
  • Is greater than / equal to
    The condition is met if the purchase price is 20.00 or more.
  • Is less than
    The condition is met if the purchase price is less than 20.00.
  • Is lower than / equal to
    The condition is met if the purchase price is 20.00 or less.
  • Is not equal to
    The condition is fulfilled if the purchase price is not 20.00.

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

  • Is equal to
    The condition is met if the total price is exactly 50.00.
  • Is greater than
    The condition is met if the total price is over 50.00.
  • Is greater than / equal to
    The condition is met if the total price is 50.00 or more.
  • Is less than
    The condition is met if the total price is less than 50.00.
  • Is lower than / equal to
    The condition is met if the total price is 50.00 or less.
  • Is not equal to
    The condition is fulfilled if the total price is not 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

  • Is equal to
    The condition is met if the price of a position is exactly 30.00.
  • Is greater than
    The condition is met if the price of a position is over 30.00.
  • Is greater than / equal to
    The condition is met if the price of a position is 30.00 or more.
  • Is less than
    The condition is met if the price of a position is less than 30.00.
  • Is lower than / equal to
    The condition is met if the price of a position is 30.00 or less.
  • Is not equal to
    The condition is fulfilled if the price of a position is not 30.00.

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 Aluminum Mainstay

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

    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.

    • Is one of
      The condition is met because the category of the product in the category tree is subordinate to the category from the condition.
    • Is none of
      The condition is not met because there is a relationship with the category.

    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.

    • Yes
      The condition is met if one of the queried products is marked as on sale.
    • No
      The condition is met if none of the queried products are marked as on sale.

    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

    • Is equal to
      The condition is met if there are exactly 5 "Sleek Wool Wasabi Fresh" products in the shopping cart.
    • Is greater than
      The condition is met if there are more than 5 "Sleek Wool Wasabi Fresh" products in the shopping cart.
    • Is greater than / equal to
      The condition is met if there are 5 or more "Sleek Wool Wasabi Fresh" products in the shopping cart.
    • Is less than
      The condition is met if there are less than 5 "Sleek Wool Wasabi Fresh" products in the shopping cart.
    • Is lower than / equal to
      The condition is met if there are 5 or less "Sleek Wool Wasabi Fresh" products in the shopping cart.
    • Is not equal to
      The condition is met if the shopping cart does not contain the product "Sleek Wool Wasabi Fresh" 5 times.

    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

    • Is equal to
      The condition is met if a product is exactly 750 wide.
    • Is greater than
      The condition is met if a product is wider than 750.
    • Is greater than / equal to
      The condition is met if a product is 750 or wider.
    • Is less than
      The condition is met if a product is narrower than 750.
    • Is lower than / equal to
      The condition is met if a product is 750 or narrower.
    • Is not equal to
      The condition is met if a product is not 750 wide.

    Line item property

    Using the operators "Is one of" and "Is none of" you can perform checks on product properties.

    Example: XL
    • Is one of
      The condition is met if a product has been assigned the property "XL".
    • Is none of
      The condition is met if no product has been assigned the property "XL".
     

    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 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 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

    • Is equal to
      The condition is met if the weight of a product is exactly 5.
    • Is greater than
      The condition is met if product is heavier than 5.
    • Is greater than / equal to
      The condition is met if the product weights 5 or more.
    • Is less than
      The condition is met if product is lighter than 5.
    • Is lower than / equal to
      The condition is met if the product weights 5 or less.
    • Is not equal to
      The condition is met if the weight of a product is not 5.

    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

    • Is equal to
      The condition is met when a product is exactly 350 in height.
    • Is greater than
      The condition is fulfilled if a product is higher than 350.
    • Is greater than / equal to
      The condition is met if a product is 350 or higher.
    • Is less than
      The condition is met if a product is smaller than 350.
    • Is lower than / equal to
      The condition is met if a product is 350 or smaller.
    • Is not equal to
      The condition is met if a product is not 350 high.

    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

    • Is equal to
      The condition is met if a product is exactly 475 long.
    • Is greater than
      The condition is met if a product is longer than 475.
    • Is greater than / equal to
      The condition is met if a product is 475 or longer.
    • Is less than
      The condition is met if a product is shorter than 475.
    • Is lower than / equal to
      The condition is met if a product is 475 or shorter.
    • Is not equal to
      The condition is met if a product is not 475 long.

    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.
     
    • Is one of
      The condition is met if one of the selected tax rates are assigned to a product.
    • Is none of
      The condition is met if none of the selected tax rates are assigned to a product.

    Line item list price

    Allows you to use the list price of a product as a condition.

    Example: 15

    • Is equal to
      The condition is met if the list price of a product is exactly 15.
    • Is greater than
      The condition is met if the list price of a product is higher than 15.
    • Is greater than / equal to
      The condition is met if the list price of a product is 15 or higher.
    • Is less than
      The condition is met if the list price of a product is less than 15.
    • Is lower than / equal to
      The condition is met if the list price of a product is 15 or less.
    • Is not equal to
      The condition is met if the list price of a product is not 15.

    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
    • Is one of
      The condition is met if a product is associated with the tag "Testtag1".
    • Is none of
      The condition is met if a product is not associated with the tag "Testtag1".

    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

    • Is equal to
      The condition is met if there are exactly 8 items in the shopping cart.
    • Is greater than
      The condition is met if there are more than 8 items in the shopping cart.
    • Is greater than / equal to
      The condition is met if there are 8 or more items in the shopping cart.
    • Is less than
      The condition is met if there are less than 8 items in the shopping cart.
    • Is lower than / equal to
      The condition is met if there are 8 or less items in the shopping cart.
    • Is not equal to
      The condition is met if the shopping cart does not contain 8 items.

    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 equal to
      The condition is met if the total value of the goods in the shopping cart are exactly 49.99.
    • Is greater than
      The condition is met if the total value of the goods in the shopping cart are above 49.99.
    • Is greater than / equal to
      The condition is met if the total value of the goods in the shopping cart are 49.99 or more.
    • Is less than
      The condition is met if the total value of the shopping cart goods are less than 49.99.
    • Is lower than / equal to
      The condition is met if the total value of the goods in the shopping cart are 49.99 or less.
    • Is not equal to
      The condition is met if the total value of the goods in the shopping cart are not 49.99.

    Shipping postal code

    For the postcode of the shipping address you can use the operators "Is one of" and "Is none of".

    Example: 48612, 48624, 48683

    • Is one of
      This condition applies if the postcode of the delivery address is 48612, 48624 or 48683.
    • Is none of
      This condition applies if the postcode of the delivery address is not 48612, 48624 or 48683.

    Shipping country

    For the delivery country, you define the condition using the operators "Is one of" or "Is none of".

    Example: Cananda

    • Is one of
      The condition is met if Canada is specified as the delivery country.
    • Is none of
      This condition applies if a delivery country other than Canada has been selected.

    Shipping street

    You can use the operators "Is equal to" or "Is not equal to" for the delivery street condition.

    Example: Ebbinghoff 10

    • Is equal to
      This condition applies if Ebbinghoff 10 is stored as delivery street.
    • Is not equal to
      This condition applies if Ebbinghoff 10 is not stored as delivery street.

    Days since last order

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

    Example: 10

    • Is equal to
      The condition is met if exactly 10 days have passed since the last order.
    • Is greater than
      The condition is met if more than 10 days have passed since the last order.
    • Is greater than / equal to
      The condition is met if 10 or more days have passed since the last order.
    • Is less than
      The condition is met if less than 10 days have passed since the last order.
    • Is lower than / equal to
      The condition is met if 10 days or less have passed since the last order.
    • Is not equal to
      The condition is met if the days since the last order does not match 10 days.

    Line item is promoted

    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.

    • Yes
      The condition is met if a product is promoted.
    • No
      The condition is met if there are no promoted products.

    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

    • Is one of
      This condition only applies if the purchase is made through the main shop.
    • Is none of
      This condition is applicable if the purchase is not made through the main shop.

    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
    • Is one of
      The condition is met if express shipping is selected.
    • Is none of
      The condition is met if no express shipping is selected.

    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.

    • Yes
      The condition is met if there are articles in the shopping cart that are free of shipping costs.
    • No
      The condition is met if there are no articles in the shopping cart that are free of shipping costs.

    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

    • Is one of
      The condition is met if euro or pound are used as currency.
    • Is none of
      This condition is met if neither euro nor pound are selected as currency.
      

    Weight of cart

    Check for the weight of the entire shopping cart.

    Example: 2,0

    • Is equal to
      The condition is met when the shopping cart weight is exactly 2.0.
    • Is greater than
      The condition is met if the shopping cart weight heavier than 2.0.
    • Is greater than / equal to
      The condition is met if the shopping cart weighs 2.0 or more.
    • Is less than
      The condition is met if product is lighter than 2.0.
    • Is lower than / equal to
      The condition is met if the shopping cart weights 2.0 or less.
    • Is not equal to
      DThe condition is met if the shopping cart weight is not 2.0.

    Cart amount

    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

    • Is equal to
      The condition is met if the total value of the shopping cart is exactly 49.99.
    • Is greater than
      The condition is met if the total value of  the shopping cart is above 49.99.
    • Is greater than / equal to
      The condition is met if the total value of shopping cart is 49.99 or more.
    • Is less than
      The condition is met if the total value of the shopping cart is less than 49.99.
    • Is lower than / equal to
      The condition is met if the total value of the shopping cart is 49.99 or less.
    • Is not equal to
      The condition is met if the total value of the shopping cart is not 49.99.

    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

    • Is equal to
      The condition is met if the current weekday is Wednesday.
    • Is not equal to
      The condition is met if the current weekday is not Wednesday.

    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
    • Is one of
      The condition is met if invoice is used as the payment method.
    • Is none of
      The condition is met if a payment method other than invoice is selected.

    Time range

    Here you define a time period in which the condition applies.

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

    Linking conditions

    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).

     

    Was this article helpful?