For the complete documentation index, see llms.txt. This page is also available as Markdown.

Delivery Option Rules

Delivery option rules determine whether a delivery option is shown to the user during checkout. Each rule evaluates the current state of the pre-order and returns true (show) or false (hide).

Rules are configured in the rule field of a Delivery Option using JSON. The slug field specifies the rule type and the remaining fields are the rule's parameters.

{
  "rule": {
    "name": "Currency Rule",
    "slug": "currency-rule",
    "currencies": ["eur", "gbp"]
  }
}

If the rule field is empty or not set, the delivery option is always shown.


Composite Rules

Composite rules allow combining multiple rules with logical operators.

and-rule

The delivery option is shown only if all child rules pass.

{
  "slug": "and-rule",
  "children": [
    { "slug": "currency-rule", "currencies": ["eur"] },
    { "slug": "registered-user-rule" }
  ]
}
Parameter
Type
Required
Description

children

array

Yes

List of child rule objects.

or-rule

The delivery option is shown if at least one child rule passes.

Parameter
Type
Required
Description

children

array

Yes

List of child rule objects.

not-rule

Inverts a child rule. The delivery option is shown if the child rule fails.

Parameter
Type
Required
Description

child

object

Yes

A single rule object.


Available Rules

any-rule

Always shows the delivery option. Equivalent to having no rule. No parameters required.

currency-rule

The delivery option is shown only if the order currency is in the specified list.

Parameter
Type
Required
Description

currencies

array

Yes

List of currency codes ("try", "eur", "usd", "gbp"). Comparison is case-insensitive. An empty list hides the delivery option for all currencies.

product-attribute-rule

The delivery option is shown based on the attributes of products in the basket.

Parameter
Type
Required
Description

attribute_field

string

Yes

The product attribute key to check.

attribute_value

any

Yes

The expected attribute value.

func

string

No

"any" (default): at least one basket product must match. "all": all basket products must match.

click-and-collect-rule

The delivery option is shown only if a retail store with click & collect enabled is selected. No parameters required.

registered-user-rule

The delivery option is shown only if the user is a registered (non-guest) user. No parameters required.

Last updated

Was this helpful?