Liquid syntax
  • Welcome
  • Introduction
    • What is Liquid syntax?
    • Liquid operators
    • Liquid objects
    • Liquid tags
    • Liquid filters
    • Best practices
  • Information
    • Attributes
    • Consolidation
    • Custom fields
    • Date filter reference
    • Deal pricing
    • Special items
  • PDF renderer
    • PDF document limitations
  • General
    • Address detail
    • Attachments
    • Company
    • Emails
    • Links
    • Phones
    • Store
  • Activity
    • Activity
  • Inventory Check
    • Inventory check (stock check)
    • Inventory check items (stock check items)
  • Invoices & Credits
    • Invoice
    • Invoice items
    • Invoice transactions
    • Invoice taxes
  • Opportunities
    • Opportunity
    • Opportunity items
    • Opportunity item assets
    • Opportunity item surcharges
    • Opportunity costs
    • Opportunity return item assets
    • Consolidated opportunity items
    • Consolidated opportunities
  • People & Organizations
    • Contact
    • Organization
    • User
    • Vehicle
    • Venue
  • Products
    • Product
    • Product group
    • Charging period
    • Product accessories
    • Product assets
    • Stock level
  • Project
    • Project
  • Purchase orders
    • Purchase order
    • Purchase order items
  • Quarantine
    • Quarantine
  • Service
    • Service
  • Testing & inspection
    • Inspection results
    • Inspection result tasks
Powered by GitBook
On this page
  • Main operators
  • contains
  • Order of operations

Was this helpful?

  1. Introduction

Liquid operators

Liquid operators are used with tags to control flow.

PreviousWhat is Liquid syntax?NextLiquid objects

Last updated 4 years ago

Was this helpful?

If you've done any computer programming before, you'll be familiar with operators. In Liquid, operators let you make logical decisions and comparisons.

For example, you might need to check if a particular number is bigger than another number, or check to see if something has been filled in.

Mathematical operations are performed using , rather than operators.

Main operators

Operator

Function

==

equals

!=

does not equal

>

greater than

<

less than

>=

greater than or equal to

<=

less than or equal to

or

logical or

and

logical and

For example, here we use less than to print a statement if an opportunity charge total is less than 100.

{% if order.charge_excluding_tax_total < 100 %}
  Spend some more money with us!
{% endif %}

contains

Use contains to check for the presence of a substring in a string.

{% if customer.email contains "current-rms.com" %}
  You work for Current RMS, lucky you!
{% endif %}

You can't use contains to check for an object in an array of objects. It only searches strings.

Order of operations

In tags with more than one and or or operator, operators are checked in order from right to left.

{% if true or false and false %}
  This evaluates to true, since the 'and' condition is checked first.
{% endif %}
{% if true and false and false or true %}
  This evaluates to false, since the tags are checked like this:

  true and (false and (false or true))
  true and (false and true)
  true and false
  false
{% endif %}

It's especially useful for multi-select , where selected list options are stored as a comma-separated string.

Liquid filters
custom fields