Advanced conditions allow you to use expressions and functions to dynamically modify certain text fields.
- Expressions can be used in text fields such as:
- Fields for titles
- Captions for field X
- Price
- Conditions and expressions can include parameters.
- Conditions and expressions can include predefined functions.
- Conditions and expressions can be written using operators.
- Expressions must be written inside curly braces, “{}”.
Curly braces are not allowed inside strings in these fields.
Check the Advanced conditions box to activate the use of advanced conditions:
Examples of advanced conditions
Example: Deliver next working day - weekday
The shipment will be delivered to the door the next working day (receiver's timezone).
- Today is Friday.
- Text will be displayed as a weekday.
- Expression: {nextWorkDayReceiver()}
Enter:
Section Fields for titles > Field English (en): Delivery to your door on {nextWorkDayReceiver()}
Result:
Example: Deliver next working day and add one day - weekday
The shipment will be delivered to the door in one working day as from next working day (receiver's timezone).
- Today is Friday.
- Text will be displayed as a weekday.
- Expression: {nextWorkDayReceiver()+day}
Enter:
Section Fields for titles > Field English (en): Delivery to your door on {nextWorkDayReceiver()+day}
Result:
Example: Deliver next working day and add days - date
The shipment will be delivered to the curbside in three working days as from next working day (receiver's timezone).
- Today is Friday 2021-09-17.
- Text will be displayed as a date.
- Expression: {nextWorkDateReceiver()+day*3}
Enter:
Section Fields for titles > Field English (en): Delivery to your curbside on {nextWorkDateReceiver()+day*3}
Result:
Example: Add days and deliver next working day
The shipment will be delivered to your home next working day as from three days from today (receiver's timezone).
- Today is Friday 2021-09-17.
- Text will be displayed as a date.
- Expression: {nextWorkDateReceiver(dateNowReceiver+day*3)}
Enter:
Section Fields for titles > Field English (en): Delivery to your home on {nextWorkDateReceiver(dateNowReceiver+day*3)}
Result:
Example: Deliver next working day and add days, if today is weekend
If the order is placed on a weekend (sender's timezone), the shipment will be delivered in two days as from next working day (receiver's timezone).
- Today is Saturday.
- Text will be displayed as a weekday.
- Condition: todayIsWeekendSender() = TRUE
- Expression: {nextWorkDayReceiver()+day*2}
Enter:
Section Fields for titles > Field Condition: todayIsWeekendSender() = TRUE
Section Fields for titles > Field English (en): Delivery to your home on {nextWorkDayReceiver()+day*2}
Result:
Example: Deliver first working day next year
The shipment will be delivered to your home next working day (sender's timezone) as from a specific date.
- Text will be displayed as a date.
- Expression with argument: {nextWorkDateSender("2021-12-31")}
Enter:
Section Fields for titles > Field English (en): Delivery to your door on {nextWorkDateSender("2021-12-31")}
Result:
Example: Delivery next day if order is placed before cut-off time
The shipment will be delivered next day if the order is placed before 14:00 (receiver's timezone).
- Create a new delivery option and associated service.
- Click New in the Fields for titles section.
- Go to the Basic information section and enter timeNowReceiver < "14:00" in the Condition field.
In the Language section, enter Next day delivery in the English (en) field.
- Click OK.
- Click New in the Fields for titles section.
- Go to the Basic information section and enter Delivery in 2-3 days in the English (en) field.
- Result if the order is placed at 11 a.m.:
Result if the order is placed at 3 p.m.:
To test the condition use the parameter currentutcdatetime with value, for example, 2022-09-12 11:00 and 2022-09-12 15:00 respectively.
Example: Use custom parameters to display shipping price
The shipping price is 10 EUR.
- Create a new custom parameter:
- Name: baseshippingprice
- Type: Decimal number
- Default: 10
- Create a new delivery option and associated service.
- When adding the service, click New in the Prices section.
- Enter {baseshippingprice} EUR in the English (en) field.
Enter {baseshippingprice} in the Price field.
- Result:
Example: Use custom parameters to add a surcharge to the shipping price
The shipment price is higher if the shipment weighs 200 kg or more.
- Create a new custom parameter:
- Name: baseshippingprice
- Type: Decimal number
- Default: 10
- Create a new custom parameter:
- Name: weightsurcharge
- Type: Decimal number
- Default: 0.2
- Create a new delivery option and associated service.
- When adding the service, click New in the Prices section.
- Enter weight < 200 in the Condition field.
Enter {baseshippingprice} EUR in the English (en) field.
Enter {baseshippingprice} in the Price field.
- Click OK.
- Click New in the Prices section.
- Enter weight >= 200 in the Condition field.
Enter Heavy package - {baseshippingprice*(1+weightsurcharge)} EUR in the English (en) field.
Enter {baseshippingprice*(1+weightsurcharge)} in the Price field.
- Result:
Example: Use custom parameters to add a discount to the shipping price
The shipping price is discounted with 10 %.
- Create a new custom parameter:
- Name: baseshippingprice
- Type: Decimal number
- Default: 10
- Create a new custom parameter:
- Name: discount
- Type: Decimal number
- Default: 0.9
- Create a new delivery option and associated service.
- When adding the service, click New in the Prices section.
- Enter {baseshippingprice*discount} EUR in the English (en) field.
Enter {baseshippingprice*discount} in the Price field.
- Result: