docs
  1. SCAYLE Resource Center
  2. User Guide
  3. SETTINGS
  4. Checkout
  5. Checkout Config
  6. Rule Engine

Rule Engine

The Rule Engine can be used to restrict the checkout options configured for your shop. Checkout options are based on certain conditions (rules) that you set in the SCAYLE Panel. This page describes aspects of the Rule Engine including:

Checkout Options

Checkout options correspond to different results in the Rule Engine. Based on whether conditions are met (e.g., order > cost > withTax <= 500 ), options can be:

  • Disabled (option is visible but not usable)
  • Deactivated (option is not visible and not usable)
  • Use to trigger notification (notification shown to customers when selecting the option for their order)

All options have to be configured before you can restrict them in the Rule Engine (please contact your Account Manager for questions about this configuration). You can't influence the order of options.

Option categories include:

  • Delivery Options
  • Payment Options
  • Shipping Options
  • Collection Point Delivery Options

Delivery Options

Results under Delivery Options include:

  • All Address Options
  • Collection Points
  • Diverging Billing and Shipping Address
  • Same Billing and Shipping Address

Payment Options

Methods may vary based on your specific checkout configuration. Some example payment options include:

  • Accounting
  • All Payment Methods
  • Cash on Delivery (DHL)
  • Giftcard (Epay)
  • External
  • PayPal

Example use cases

  1. Disable payment methods that are prone to fraud for certain basket values/items/shipping addresses.
  2. Restrict express payment methods to certain user groups.

Example payment options on checkout front end

Shipping Options

The available shipping options are based on specific tenant architecture. Some required shipping options for the Rule Engine have to be added. Shipping options available by default include:

  • all_shipping_options
  • express_delivery
  • least_packages
  • scheduled_delivery
  • standard_delivery

Example Shipping Options on the Checkout front end

Collection Point Delivery Options

It is possible to configure the kind of collection points that are available on the map. Only collection point deactivation is possible.

Collection Point Delivery Options

Add rules

Rules (conditions) are created at the shop level.

You can add subconditions to a rule to handle complex scenarios. However within one rule, use the same operator - do not mix AND/OR operators within the same rule. For more details, see Use Cases.

Since the rules disable options, it is easier to start with the more general excludes and then become more specific. For example, first exclude shipping options that are not relevant for one country so you don't have to repeat the exclusion in every rule.

To add a rule:

  1. Navigate to Shops > Storefront > Checkout Settings > Rule Engine.
  2. Select +ADD RULE or +ADD FIRST RULE.
  3. Complete the 3 sections on the New Rule page.
  4. General Info: Add a Name and Description for the rule.
  5. Click ADD CONDITION too add a new rule:
    • Select an object or collection from the list (e.g., order, customer, payment).
    • Menus are populated based on previous selections (e.g., order > id, customer > lastName, payment > amount).
    • When the variable selection is complete, click ADD.
    • Select the operator (e.g., =, !=, >, <, <=, IS, IS NOT, IN, NOT IN) and corresponding value (e.g., 10, London).
    • To add a subcondition, click the + SUB CONDITION button.
    • Optional Add another rule (condition) with AND/OR operators.
  6. Results: Select one or more results to trigger if the conditions are met (e.g., Payment Options > All Payment Methods > Deactivate Payment Method).

When adding a subcondition, you have to choose the same operator for multiple subconditions within the rule. For more details, see Use Cases.

Edit rules

To edit a rule

  1. Go to Shops > Storefront > Checkout Settings > Rule Engine.
  2. On the Rule Engine page, hover over the three-dot menu on the rule you want to edit, and Edit.

To deactivate a rule

  1. Go to Shops > Storefront > Checkout Settings > Rule Engine.
  2. On the Rule Engine page, hover over the three-dot menu on the rule you want to deactivate, select Deactivate.

To delete a rule

  1. Go to Shops > Storefront > Checkout Settings > Rule Engine.
  2. On the Rule Engine page, hover over the three-dot menu on the rule you want to delete, and Delete.

Use Cases / Examples

The following examples are intended to explain some real-world scenarios.

Complex scenarios might include conditions and subconditons. Within one condition you can only set subconditons using the same operator (AND/OR).

Minimum Order Value

A rule can be set for payment methods requiring a minimum order value (MOV). For example, you may want to disable the Accounting (B2B) payment method for orders less than a threshold. If MOV is not reached, the payment method is deactivated (does not appear in Checkout).

Set a rule for an order with a MOV of 50

  1. Add a Name (e.g., "MOV for Accounting") and Description (e.g., "Minimum Order Value for Accounting Payment Method").
  2. Add the Condition: order > cost > withoutServiceCost <= 5000 (50.00).
  3. Select the Result: Payment Options > Accounting | Deactivate Payment Method.
  4. Click Create.

Max Order Value

Below is a sample rule set for an order with a max order value of 700 €. All payment methods will be deactivated if the customer orders items that cost higher than 700 €.

Set a rule for an order with a max value of 700 €

  1. Add a Name (e.g., "Max Order Value") and Description (e.g., "Max. order value = 700 €").
  2. Add the Condition: e.g., order > cost > withTax > 70000 (700.00)
  3. Select the Results: e.g.,
    • Payment Options > All Payment Methods | Disable Payment Method
    • Payment Options > All Payment Methods | Trigger Error Message
    • Add error message (e.g, "The maximum order value is 700 €")
  4. Click Create to save the rule.

Shipping Costs per Country

A rule can be set to enable/disable specific shipping costs for a given shipping country (global or EU shop). For example, you can create a rule where, if a customer selects a shipping country, all shipping options are disabled that do not have a specific cost.

For details on setting Shipping Options (including shipping cost) see Shipping Options.

Set a rule for shipping costs for a given shipping country

  1. Add a Name (e.g., "Shipping costs by country") and Description (e.g., "Enable 34,38 euro for respective countries").
  2. Add the Condition: e.g., address > shipping > countryCode IS TUR
  3. Select the Results: e.g.,
    • Shipping Options > rule-engine.available_shipping_options.1299 | Deactivate Shipping Options
    • Shipping Options > rule-engine.available_shipping_options.1546 | Deactivate Shipping Options
    • Shipping Options > rule-engine.available_shipping_options.1427 | Deactivate Shipping Options
    • Deactivate other shipping options where shipping cost ≠ 34,38
  4. Click Create to save the rule.

For conditions with countryCode use the "iso_alpha3” (e.g., for Germany it is DEU).

Free shipping for a given time period

Rules can be set to enable free shipping for a given time period (e.g., promotion campaign). This requires 2 rules, one to enable free shipping and another to define standard shipping outside the free shipping time period.

Set a rule for shipping for a given time period

  1. Add a Name (e.g., "Free Shopping Option") and Description (e.g., "Free shipping for time frame + min. order value").
  2. Add the Conditions: e.g.,
    • order > cost > withoutServiceCost >= 4000 (40.00)
    • AND client > currentTime between 06-03-2023 09:00:00 - 09-03-2023 00:00:00
  3. Select the Results: e.g., Shipping Options > DHL Standard | Deactivate Shipping Options
  4. Click Create to save the rule.

Set a rule to disable free shipping

  1. Add a Name (e.g., "Free Shopping Disable") and Description (e.g., "Enable free shipping only when campaign is active").
  2. Add the Conditions: e.g.,
    • client > currentTime before 06-03-2023 09:00:00
    • OR client > currentTime after 09-03-2023 00:00:00
    • OR order > cost > withoutServiceCost <= 4000 (40.00)
  3. Select the Results: e.g., Shipping Options > DHL Standard (free shipping) | Deactivate Shipping Options
  4. Click Create to save the rule.

Setting Multiple Subconditions

Free Shipping for a time period for chosen customers

You can set a rule containing multiple statements, however within a statement, use the same operator. A single rule can contain multiple subconditions joined by one operator (such as a sub-condition AND another subcondition AND another subcondition), but you cannot mix operators within a single rule. To add a statement with a different operator, create a new rule.

Use case Set free shipping for all women living in Berlin or Hamburg for orders from the 7th of March until the 9th of March.

One rule targets:

  • Main condition: is female
    1. Sub condition: shipping after the 7th of March.
      AND
    2. Sub condition: shipping before the 9th of March.

To target women who live in Berlin OR in Hamburg, we have to add a new condition, as we cannot mix operators AND/OR within the same condition statement.

  • Main Condition: lives in Germany.
  1. Sub condition: lives in Berlin OR
  2. Sub condition: lives in Hamburg

To add multiple conditions and subconditions

  1. Go to Shops > Storefront > Checkout Settings > Rule Engine
  2. Select +ADD RULE.
  3. Add a Name and Description.
  4. Click ADD CONDITION too add a new rule.
  5. Select customer > gender > ADD.
  6. Choose the IS and select f from the dropdown. Specify the timeframe:
  7. Click +SUB CONDITION, then order > createdAt > datetimeOperations > ADD. Select before from the dropdown. Pick the date and time from the calendar.
  8. Click ADD CONDITION, then order > updatedAt > datetimeOperations > ADD. Select after from the dropdown. Pick the date and time from the calendar.

Add new condition to specify location

  1. Multiple locations possible using OR operator:
  2. Click ADD CONDITION too add a new rule:
  3. Select address > shipping > city > ADD. Type a city, for example "Berlin".
  4. Click +SUB CONDITION, then address > shipping > city > ADD. Type a city, for example "Hamburg".
  5. Switch toggle to OR.

Add free shipping

  1. Select the Results:
    Shipping Options > DHL Standard | Deactivate Shipping Options.
  2. Click Create to save the rule.

Data model explanation

You can access a variety of properties to build your custom rules. Rules can be written on the following standardized data structure. Not all information will be available from beginning to end during the ordering process, for example a shipping address will not yet be available for new customers when evaluating rules for the delivery options filter.

Example data
{
    "address": {
        "billing": {
            "id": 998,
            "additional": "c/o SCAYLE",
            "city": "Hamburg",
            "countryCode": "DEU",
            "houseNumber": "12",
            "isDefault": {
                "billing": false,
                "shipping": false
            },
            "recipient": {
                "firstName": "Anna",
                "gender": "m",
                "lastName": "Doe"
            },
            "referenceKey": "address-7656",
            "street": "Hauptstraße",
            "zipCode": "20459"
        },
        "shipping": {
            "id": 998,
            "city": "Hamburg",
            "collectionPoint": {
                "customerKey": "bced-234-234",
                "description": "Pedro's Kiosk",
                "key": "12345-a",
                "type": "hermes_parcelshop"
            },
            "countryCode": "DEU",
            "houseNumber": "10",
            "isDefault": {
                "billing": false,
                "shipping": false
            },
            "recipient": {
                "firstName": "Anna",
                "gender": "m",
                "lastName": "Doe"
            },
            "referenceKey": "address-7656",
            "street": "Domstrasse",
            "zipCode": "20459"
        }
    },
    "application": {
        "appId": 139,
        "countryCode": "DEU",
        "currencyCode": "EUR",
        "device": "desktop",
        "languageCode": "DE"
    },
    "client": {
        "currentTime": "2018-01-20T09:30:15+00:00",
        "ip": "0.0.0.0",
        "languageCode": "FR",
        "location": {
            "city": "Offenbach",
            "countryCode": "DEU",
            "region": "Hessen"
        },
        "userAgent": {
            "browser": "Chrome",
            "device": "desktop",
            "platform": "Windows",
            "version": "7.0"
        }
    },
    "customer": {
        "id": 9876,
        "authentication": {
            "data": {
                "accessToken": "a0we0effg424",
                "userId": "567765"
            },
            "type": "password"
        },
        "birthDate": "1981-02-02",
        "customData": {
            "score": {
                "requestFailed": true
            }
        },
        "email": "[email protected]",
        "firstName": "Anna",
        "gender": "f",
        "groups": [
            {
                "item": "new"
            },
            {
                "item": "app"
            }
        ],
        "lastName": "Doe",
        "phone": "0049/1234567890",
        "referenceKey": "customer-1234",
        "status": {
            "isActive": true,
            "isGuestCustomer": false,
            "isTestCustomer": false
        },
        "createdAt": "2018-01-20T09:30:15+00:00",
        "updatedAt": "2018-01-20T09:30:15+00:00"
    },
    "items": [
        {
            "availableQuantity": 20,
            "customData": {
                "key": "value"
            },
            "deliveryForecast": {
                "deliverable": {
                    "key": "directShipping",
                    "quantity": 18
                },
                "subsequentDelivery": {
                    "key": "christmas",
                    "quantity": 2
                }
            },
            "itemGroup": {
                "id": "ab123",
                "isMainItem": true,
                "isRequired": true
            },
            "key": "ac834d23e689u678",
            "packageId": 1,
            "price": {
                "appliedReductions": [
                    {
                        "amount": {
                            "absoluteWithTax": 100,
                            "relative": 0.5
                        },
                        "category": "sale",
                        "type": "relative"
                    }
                ],
                "reference": {
                    "size": "100",
                    "unit": "ml",
                    "withTax": 595
                },
                "tax": {
                    "vat": {
                        "amount": 190,
                        "rate": 0.19
                    }
                },
                "withoutTax": 1000,
                "withTax": 1190
            },
            "product": {
                "id": 4564545,
                "advancedAttributes": {
                    "materialCompositionTextile": {
                        "key": "materialCompositionTextile",
                        "label": "Materialzusammensetzung",
                        "values": [
                            {
                                "fieldSet": [
                                    [
                                        {
                                            "value": "Lining"
                                        }
                                    ]
                                ],
                                "groupSet": [
                                    {
                                        "fieldSet": [
                                            [
                                                {
                                                    "value": 80
                                                },
                                                {
                                                    "unit": "%"
                                                },
                                                {
                                                    "material": "Cotton"
                                                }
                                            ]
                                        ],
                                        "groupSet": [
                                        ]
                                    }
                                ]
                            }
                        ]
                    }
                },
                "attributes": {
                    "description": {
                        "key": "description",
                        "label": "Beschreibung",
                        "values": [
                            {
                                "id": 1234,
                                "label": "A descriptive string (possibly including HTML)",
                                "value": "Optional value"
                            }
                        ]
                    }
                },
                "categories": [
                    [
                        {
                            "categoryId": 20201,
                            "categoryName": "Frauen",
                            "categoryProperties": {
                                "priority": {
                                    "name": "priority",
                                    "value": "1"
                                }
                            },
                            "categoryUrl": "/frauen"
                        }
                    ]
                ],
                "definingAttributes": [
                    {
                        "key": "color",
                        "label": "Farbe"
                    }
                ],
                "images": [
                    {
                        "attributes": {
                            "description": {
                                "key": "description",
                                "label": "Beschreibung",
                                "values": [
                                    {
                                        "label": "A descriptive string (possibly including HTML)"
                                    }
                                ]
                            }
                        },
                        "hash": "9f6c628a98106dcce2bc5a4ac1de9c14"
                    }
                ],
                "masterKey": "480306626-1",
                "name": "Chelsea Boots",
                "createdAt": "2018-01-20T09:30:15+00:00",
                "updatedAt": "2018-01-20T09:30:15+00:00"
            },
            "status": "available",
            "variant": {
                "id": 1234567,
                "attributes": {
                    "vendorSize": {
                        "key": "vendorSize",
                        "label": "Größe",
                        "values": [
                            {
                                "id": 25472,
                                "label": "34",
                                "value": "Thirty Four"
                            }
                        ]
                    }
                },
                "referenceKey": "563843898",
                "stock": {
                    "customData": {
                    },
                    "deliveryForecast": {
                        "deliverable": {
                            "key": "directShipping",
                            "quantity": 18
                        },
                        "subsequentDelivery": {
                            "key": "christmas",
                            "quantity": 2
                        }
                    },
                    "isSellableWithoutStock": false,
                    "quantity": 18,
                    "supplierId": 271
                },
                "createdAt": "2018-01-20T09:30:15+00:00",
                "updatedAt": "2018-01-20T09:30:15+00:00"
            },
            "createdAt": "2018-01-20T09:30:15+00:00",
            "updatedAt": "2018-01-20T09:30:15+00:00"
        }
    ],
    "order": {
        "id": 123,
        "appliedLoyaltyPoints": 0,
        "basketKey": "basket-c6v7k4eer1",
        "cost": {
            "appliedReductions": [
                {
                    "amount": {
                        "absoluteWithTax": 100,
                        "relative": 0.5
                    },
                    "category": "voucher",
                    "type": "absolute"
                }
            ],
            "capture": 1090,
            "tax": {
                "vat": {
                    "amount": 123,
                    "rate": 0.5
                }
            },
            "withoutServiceCost": 1190,
            "withoutTax": 1000,
            "withTax": 1190
        },
        "currencyCode": "EUR",
        "customData": {
            "score": {
                "requestFailed": true
            }
        },
        "referenceKey": "order-2234",
        "createdAt": "2018-01-20T09:30:15+00:00",
        "updatedAt": "2018-01-20T09:30:15+00:00"
    },
    "packages": [
        {
            "id": 1,
            "carrierKey": "dhl",
            "deliveryDate": {
                "maximum": "2018-02-05",
                "minimum": "2018-02-02"
            },
            "deliveryStatus": "open",
            "returnIdentCode": "100-1",
            "shipmentKey": "shpmnt-100-1",
            "tracking": {
                "id": "79003131200523",
                "url": "https://tracking.hermesworld.com/?TrackID=79003131200523"
            }
        }
    ],
    "payment": [
        {
            "amount": 1190,
            "data": {
                "CCBrand": "VISA",
                "CCExpiry": "202005",
                "IPCity": "charlottenburg",
                "IPLatitude": "52.5151",
                "IPLongitude": "13.3053",
                "IPState": "berlin",
                "IPZone": "276",
                "IPZoneA2": "de"
            },
            "key": "computop_creditcard",
            "transactionKey": "creditcard-abcde"
        }
    ],
    "vouchers": [
        {
            "id": 198234,
            "applicableItems": [
                {
                    "isApplied": true,
                    "key": "a87ff679a2f3e71d9181a67b7542122c"
                },
                {
                    "isApplied": false,
                    "key": "eccbc87e4b5ce2fe28308fd9f2a7baf3"
                }
            ],
            "code": "fashion2020",
            "type": "absolute",
            "value": 1000
        }
    ]
}
Schema
{
  "address": {
    "billing": {
      "id": "integer",
      "additional": "string",
      "city": "string",
      "collectionPoint": {
        "customerKey": "string",
        "description": "string",
        "key": "string",
        "type": "string"
      },
      "countryCode": "string",
      "houseNumber": "string",
      "isDefault": {
        "billing": "boolean",
        "shipping": "boolean"
      },
      "recipient": {
        "firstName": "string",
        "gender": "enum",
        "lastName": "string"
      },
      "referenceKey": "string",
      "street": "string",
      "title": "string",
      "zipCode": "string"
    },
    "shipping": {
      "id": "integer",
      "additional": "string",
      "city": "string",
      "collectionPoint": {
        "customerKey": "string",
        "description": "string",
        "key": "string",
        "type": "string"
      },
      "countryCode": "string",
      "houseNumber": "string",
      "isDefault": {
        "billing": "boolean",
        "shipping": "boolean"
      },
      "recipient": {
        "firstName": "string",
        "gender": "enum",
        "lastName": "string"
      },
      "referenceKey": "string",
      "street": "string",
      "title": "string",
      "zipCode": "string"
    }
  },
  "application": {
    "appId": "integer",
    "countryCode": "string",
    "currencyCode": "string",
    "device": "string",
    "languageCode": "string"
  },
  "client": {
    "currentTime": "string",
    "ip": "string",
    "languageCode": "string",
    "location": {
      "city": "string",
      "countryCode": "string",
      "region": "string"
    },
    "userAgent": {
      "browser": "string",
      "device": "string",
      "platform": "string",
      "version": "string"
    }
  },
  "customer": {
    "id": "integer",
    "authentication": {
      "data": {
        "accessToken": "string",
        "userId": "string"
      },
      "type": "enum"
    },
    "birthDate": "string",
    "customData": {},
    "email": "string",
    "firstName": "string",
    "gender": "enum",
    "groups": [
      {
        "item": "string"
      }
    ],
    "lastName": "string",
    "phone": "string",
    "publicKey": "string",
    "referenceKey": "string",
    "status": {
      "isActive": "boolean",
      "isGuestCustomer": "boolean",
      "isTestCustomer": "boolean"
    },
    "title": "string",
    "type": "enum",
    "createdAt": "string",
    "updatedAt": "string"
  },
  "items": [
    {
      "availableQuantity": "integer",
      "customData": {},
      "deliveryForecast": {
        "deliverable": {
          "key": "string",
          "quantity": "integer"
        },
        "subsequentDelivery": {
          "key": "enum",
          "quantity": "integer"
        }
      },
      "itemGroup": {},
      "key": "string",
      "packageId": "integer",
      "price": {
        "appliedReductions": [
          {
            "amount": {},
            "absoluteWithTax": "integer",
            "relative": "number",
            "category": "enum",
            "type": "enum"
          }
        ],
        "reference": {
          "size": "string",
          "unit": "string",
          "withTax": "integer"
        },
        "tax": {
          "$key": {}
        },
        "withoutTax": "integer",
        "withTax": "integer"
      },
      "product": {
        "id": "integer",
        "advancedAttributes": {},
        "attributes": {},
        "categories": [
          {
            "categoryHidden": "boolean",
            "categoryId": "integer",
            "categoryName": {},
            "categoryProperties": {},
            "categoryUrl": {}
          }
        ],
        "definingAttributes": [
          {
            "key": "string",
            "label": "string"
          }
        ],
        "images": [
          {
            "attributes": {},
            "hash": "string"
          }
        ],
        "masterKey": "string",
        "name": "string",
        "createdAt": "string",
        "updatedAt": "string"
      },
      "reservationKey": "string",
      "status": "enum",
      "variant": {
        "id": "integer",
        "advancedAttributes": {},
        "attributes": {},
        "referenceKey": "string",
        "stock": {
          "customData": {},
          "deliveryForecast": {},
          "deliverable": {},
          "subsequentDelivery": {},
          "isSellableWithoutStock": "boolean",
          "quantity": "integer",
          "supplierId": "integer"
        },
        "createdAt": "string",
        "updatedAt": "string"
      },
      "warehouseId": "integer",
      "createdAt": "string",
      "updatedAt": "string"
    }
  ],
  "order": {
    "id": "integer",
    "appliedLoyaltyPoints": "integer",
    "basketKey": "string",
    "campaignKey": "string",
    "confirmedAt": "string",
    "cost": {
      "appliedFees": [
        {
          "amount": {},
          "category": "enum",
          "key": "string",
          "option": "string"
        }
      ],
      "appliedReductions": [
        {
          "amount": {},
          "absoluteWithTax": "integer",
          "relative": "number",
          "category": "enum",
          "type": "enum"
        }
      ],
      "capture": "integer",
      "tax": {
        "$key": {}
      },
      "withoutServiceCost": "integer",
      "withoutTax": "integer",
      "withTax": "integer"
    },
    "currencyCode": "string",
    "customData": {},
    "referenceKey": "string",
    "createdAt": "string",
    "updatedAt": "string"
  },
  "packages": [
    {
      "id": "integer",
      "carrierKey": "string",
      "deliveryDate": {
        "maximum": "string",
        "minimum": "string"
      },
      "deliveryStatus": "enum",
      "returnIdentCode": "null,string",
      "shipmentKey": "string",
      "tracking": {
        "id": "string",
        "url": "string"
      }
    }
  ],
  "payment": [
    {
      "amount": "integer",
      "data": {},
      "installment": [
        {
          "amount": "integer",
          "type": "enum"
        }
      ],
      "key": "string",
      "paymentMethod": "string",
      "status": "enum"
    }
  ]
}

Further education - SCAYLE Academy