Conditions
In nShift Checkout you can use conditions to adapt your checkout to your needs.
Conditions are written using parameters and operators.
Conditions
Conditions are used to determine what should be shown in your checkout.
Conditions can be used in condition fields for e.g.:
Delivery options
Services
Addons
Price
Conditions can include parameters.
Conditions are written using operators.
Some parameters already exist in the system, but you can also add your own.
Parameters are configured in the GUI. If you do not set a default value, the parameter must be set in the API call. Parameters connected to the sender are set automatically.
Notice
Parameters correspond to Klarna tags.
Set default value for a parameter
Go to
> .When creating a new delivery checkout you add default values to parameters on the New delivery checkout page.
To add default values to parameters on an existing delivery checkout, click
to the left of the delivery checkout on the Delivery checkout page.
Click
to the left of a parameter.
The parameter appears in the field Name under the parameter list.
Enter a value in the Default field using the Type defined for the parameter.
Click
.
Create and add your own parameters
You can add parameters to a new or existing delivery checkout.
Go to
> .When creating a new delivery checkout you create new parameters on the New delivery checkout page.
To add new parameters on an existing delivery checkout, click
to the left of the delivery checkout on the Delivery checkout page.
In the Parameters section you can enter name, type and default value.
Click
.
You delete the parameter by clicking next to it.
Tags/parameters
Parameters/tags (text) can have a value (string).
Separate the parameter/tag and the value with a colon (:).
Example: "products:4"
You can't use a numerical value with relative operators, such as ">" or "<".
Parameter/tag values can be used to create conditions for numerical values (text) by using condition lists for valid/invalid values.
A tag/parameter can also be boolean.
The tag is sent to Klarna = true
The tag isn't sent to Klarna = false
Example: "freefreight"
The following operators are used to state conditions.
Operator | Meaning |
---|---|
> | greater than |
>= | greater than or equal to |
< | less than |
<= | less than or equal to |
= | equal to |
!= | not equal to |
! | not |
& | and |
| | or |
? | list |
Tip
When using only &-operators in an expression, all expressions must be true for the entire expression to be true.
Example:
tocountry = "SE" & fromcountry = "SE"
When using only |-operators in an expression at least one of the expressions must be true for the entire expression to be true.
Example:
tocountry = "SE" | tocountry = "DK" | tocountry = "FI"
Always use excluding conditions in e.g. a price list. Otherwise it's the order that decides.
Example:
cartprice >= 500.0
cartprice < 500.0
Use parentheses to decide in which order expressions should be evaluated to render the expected result.
Example:
weight <=20.0 & tocountry = "SE" | tocountry = "DK"
results in
weight = 40.0 and tocountry=DK is true
weight = 10.0 and tocountry=DK is true
while
weight <=20.0 & (tocountry = "SE" | tocountry = "DK")
results in
weight = 40.0 and tocountry=DK is false
weight = 10.0 and tocountry=DK is true
Instead of creating new parameters or having to write long and complicated expressions you can use ! and != to invert boolean expressions.
Example:
!B2B is true if B2B is false
tocountry != "SE" is true if tocountry is not SE
Use condition lists to evaluate against a large amount of values, e.g. zip codes.
Example:
tozipcode ? "zipcodes_in_gbg_sthlm"
Condition lists make it easy to import large amounts of data.
Create a list in .txt format with, for example, zip code ranges and/or single zip code items. The ranges and items must be entered on separate rows. Use a semicolon (;) between items to indicate a range.
Example
11130;11140
11145
11160;11170
11175
11180;11190
41130;41140
41145
41160;41170
41175
41180;41190
Upload and activate a condition list
You need to upload and activate the condition list.
Tip
To always activate the condition list immediately when uploading, use the uselatestlist
parameter.
Go to
> .Click
.Click
and select the condition list file.Search for the list to activate it manually. The list has status "OK".
Click
to the left of the list and then . An active list has status "OK (Active)".
You can change the name of the list or delete it, but you can not deactivate it.