isif Element

Create conditional template code and control the flow of business logic.


<isif condition = if_expression>
 <iselseif condition = elseif_expression> //0 or more
condition = if_expression

Allowed data type: string or expression.

if_expression evaluates to a boolean value. If the <isif> condition is true, the system executes the code immediately following the <isif> tag, ignoring the enclosed <iselseif> and <iselse> tags. If the <isif> condition is false, the system ignores the code immediately following the <isif> tag, and then tests each <iselseif> condition in order. When the system finds a true <iselseif> condition, the system executes the code immediately following the <iselseif> tag and ignores any remaining <iselseif> and <iselse> tags. If all <iselseif> conditions are false, the system executes the code following the <iselse> tag.


The <isif> tag group lets you create conditional programming constructs using custom tags.

Supporting Tags

<isif> and its supporting tags, <iselseif> and <iselse>, are some of the most commonly used tags. They contain no business logic, just the conditional visualization of data.

Rules of Use

Every <isif> tag must have a matching </isif> tag. You can use any Salesforce B2C Commerce script expression as a condition for the <isif> tag. In particular, you can use local variables, Pipeline Dictionary variables and any functions within those expressions.

<iselse> and <iselseif> are optional. You can use as many <iselseif> tags as needed in an <isif> statement, but you can only use one <iselse>, which must always be the last tag within an <isif> group.


A conditional expression should typically return a boolean which is interpreted appropriately. If condition expression evaluates to non boolean and is not null, it's interpreted as true. When it evaluates to null it's interpreted as false.

<isif condition="${pdict.Products.Price == 0}"> 
Special free gift.
<iselseif condition="${pdict.Products.Price < 100}">
Special deal.
Today's low price.

This example shows how to toggle continuously between three different colors for the rows of a table. The current color is stored in the user-defined variable, color.

<isset name="color" value="${'#00FFFF'}" scope="PAGE">
<isloop iterator="${pdict.Basket.products} var="product">
<td bgcolor="${product.color}">
<isprint value = "${}">
<isif condition="${color == '#00FFFF'}">
<isset name="color" value="${'#00CCFF'}" scope="PAGE">
<iselseif condition="${color == '#00CCFF'}">
<isset name="color" value="${'#0099FF'}" scope="PAGE">
<isset name="color" value="${'#00FFFF'}">
X Privacy Update: We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used. By continuing to use this site you are giving us your consent to do this. Privacy Policy.