IF Statements

Neto's IF, IF THEN & ELSE function


[%if [@somedata@] like 'apple' %]
[%elseif [@somedata@] like 'orange' %]
[%elseif [@somedata@] ne '' %]


Simple Statements

Let's say we are working on a product template and want to display the message "Free shipping", but only on products where the price is greater than $200. Since the product will either have a price greater than $200 or less than $200, the “if” logic statement is the most appropriate statement to use:

[%if [@price@] > 200%]Free Shipping[%/if%]

Complex Statements

A complex logic statement contains two or more parameters. For example:

If you only wanted to display the "free shipping" text only when the price was greater than $200 and if the description was not empty you could use:

[%if [@price@] > 200 and [@description@] ne ''%]Free Shipping[%/if%]


== Equal to (for integers)
eq Equal to (for strings)
!= Not equal (for integers)
ne Not equal to (for strings)
< Less than
> More than
<= Less than or equal to
>= More than or equal to
or Either this or that
and Must be this and that
like Exists within string. Example: [%if "This is a string" like "is" %] would return true because is exists within the data provided.
not like Inverse of the like operator.

Was this article useful?

Be notified when this page is updated. Optional.