What is Shopify Liquid?

Shopify Liquid is a versatile and user-friendly templating language that plays a crucial role in customizing the appearance and functionality of online stores built on the Shopify platform. As a powerful tool, Liquid empowers developers and designers to create dynamic, personalized, and visually stunning ecommerce experiences for customers.

Key Features of Shopify Liquid

1. Variables

Variables in Shopify Liquid are used to store and retrieve data, such as product details, customer information, and cart items. They enable developers to access and manipulate data within Liquid templates easily. Variables are denoted by double curly braces: {{ variable_name }}.

{{ product.title }}          # Output: Product Name
{{ customer.first_name }}    # Output: John

2. Tags

Tags are the control structures in Liquid that allow you to implement logic, create conditions, and perform actions based on specific conditions. The commonly used tags include if, unless, for, and case, among others.

{% if product.available %}
  <p>This product is available.</p>
{% else %}
  <p>This product is out of stock.</p>
{% endif %}

3. Filters

Filters enable developers to modify the output of variables in various ways, such as formatting dates, converting text case, or applying currency symbols. Filters are used with variables, and they are separated by a pipe symbol |.

{{ product.price | money }}    # Output: $29.99
{{ "hello" | capitalize }}     # Output: Hello

4. Objects and Dot Notation

In Shopify Liquid, objects are used to represent data entities, such as products and customers. Dot notation allows you to access properties or attributes of objects conveniently.

{{ product.title }}            # Output: Product Name
{{ customer.first_name }}      # Output: John


Comments in Liquid are essential for making the code more readable and understandable. They have no impact on the output and are ignored during rendering.

{% comment %}
  This is a comment. It won't be displayed in the output.
{% endcomment %}