Shopify Cheat Sheet — A resource for building Shopify Themes with Liquid

The Shopify Cheat Sheet is a resource for building Shopify Themes with Liquid

What is Liquid?

Tools

Reference

The Shopify Cheat Sheet is a resource for building Shopify Themes with Liquid

What is Liquid?

You have no categories selected.

Handles

The handle is used to access the attributes of a Liquid object. By default, it is the object’s title in lowercase with any spaces and special characters replaced by hyphens (-). Every object in Liquid (product, collection, blog, menu) has a handle. Learn more

What is a handle?

The handle is used to access the attributes of a Liquid object. By default, it is the object’s title in lowercase with any spaces and special characters replaced by hyphens (-). Every object in Liquid (product, collection, blog, menu) has a handle. Learn more

<!-- the content of the About Us page -->
{{ pages.about-us.content }}

How are my handles created?

A product with the title ‘shirt’ will automatically be given the handle shirt. If there is already a product with the handle ‘shirt’, the handle will auto-increment. In other words, all ‘shirt’ products created after the first one will receive the handle shirt-1, shirt-2, and so on. Learn more

Operators

Liquid has access to all of the logical and comparison operators. These can be used in tags such as if and unless. Learn more

==

equals Learn more

{% if product.title == 'Awesome Shoes' %}
  These shoes are awesome!
{% endif %}

!=

does not equal Learn more

>

greater than Learn more

<

less than Learn more

>=

greater than or equal to Learn more

<=

less than or equal to Learn more

or

condition A or condition B Learn more

and

condition A and condition B Learn more

contains

checks for the presence of a substring inside a string or array Learn more

{% if product.title contains 'Pack' %}
  This product’s title contains the word Pack.
{% endif %}

Types

Liquid objects can return one of six types: String, Number, Boolean, Nil, Array, or EmptyDrop. Liquid variables can be initialized by using the assign or capture tags. Learn more

Strings

Strings are declared by wrapping the variable’s value in single or double quotes. Learn more

{% assign my_string = 'Hello World!' %}

Numbers

Numbers include floats and integers. Learn more

{% assign my_num = 25 %}

Booleans

Booleans are either true or false. No quotations are necessary when declaring a boolean. Learn more

{% assign foo = true %}
{% assign bar = false %}

Nil

Nil is an empty value that is returned when Liquid code has no results. It is not a string with the characters ‘nil’. Nil is treated as false in the conditions of {% if %} blocks and other Liquid tags that check for the truthfulness of a statement. Learn more

Arrays

Arrays hold a list of variables of all types. To access items in an array, you can loop through each item in the array using a for tag or a tablerow tag. Learn more

{% for tag in product.tags %}
  {{ tag }}
{% endfor %}

EmptyDrop

An EmptyDrop object is returned whenever you try to access a non-existent object (for example, a collection, page or blog that was deleted or hidden) by a handle. Learn more

Truthy and Falsy

In programming, we describe “truthy” and “falsy” as anything that returns true or false, respectively, when used inside an if statement. Learn more

What is truthy?

All values in Liquid are truthy, with the exception of nil and false. In this example, the variable is a string type but it evaluates as true. Learn more

{% assign tobi = 'tobi' %}
{% if tobi %}
  This will always be true.
{% endif %}

What is falsy?

The only values that are falsy in Liquid are nil and false. nil is returned when a Liquid object doesn’t have anything to return. For example, if a collection doesn’t have a collection image, collection.image will be set to nil. Learn more

{% if collection.image %}
  <!-- output collection image -->
{% endif %}

Whitespace Control

In Liquid, you can include a hyphen in your tag syntax {{-, -}}, {%-, and -%} to strip whitespace from the left or right side of a rendered tag. Normally, even if it doesn’t output text, any line of Liquid in your template will still output an empty line in your rendered HTML. Learn more

Whitespace Control

Using hyphens, the assign statement doesn't output a blank line. Learn more

{%- assign my_variable = "tomato" -%}
{{ my_variable }}
tomato

Conditional Tags

Conditional tags define conditions that determine whether blocks of Liquid code get executed. Learn more

{% if %}

Executes a block of code only if a certain condition is met. Learn more

{% if product.title == 'Awesome Shoes' %}
  These shoes are awesome!
{% endif %}
These shoes are awesome!

{% elsif %} / {% else %}

Adds more conditions within an if or unless block. Learn more

<!-- If customer.name is equal to 'anonymous' -->
{% if customer.name == 'kevin' %}
  Hey Kevin!
{% elsif customer.name == 'anonymous' %}
  Hey Anonymous!
{% else %}
  Hi Stranger!
{% endif %}
Hey Anonymous!

{% case %} / {% when %}

Creates a switch statement to compare a variable with different values. case initializes the switch statement and when compares its values. Learn more

{% assign handle = 'cake' %}
{% case handle %}
  {% when 'cake' %}
     This is a cake
  {% when 'cookie' %}
     This is a cookie
  {% else %}
     This is not a cake nor a cookie
{% endcase %}
This is a cake

{% unless %}

Similar to if, but executes a block of code only if a certain condition is not met. Learn more

{% unless product.title == 'Awesome Shoes' %}
  These shoes are not awesome.
{% endunless %}
These shoes are not awesome.

HTML Tags

HTML tags render HTML elements using Shopify-specific attributes. Learn more

{% form %}

Generates an HTML form tag, including any required input tags to submit the form to a specific endpoint. Learn more

{% form 'form_type' %}
  content
{% endform %}

{% style %}

Generates an HTML style tag with an attribute of data-shopify. Learn more

{% style %}
  .h1 {
     color: {{ settings.colors_accent_1 }};
  }
{% endstyle %}
<style data-shopify>
  .h1 {
    color: #121212;
  }
</style>

Iteration Tags

Iteration Tags are used to run a block of code repeatedly. Learn more

{% for %}

Repeatedly executes a block of code. Learn more

{% for product in collection.products %}
  {{ product.title }}
{% endfor %}
hat shirt pants

{% else %}

Specifies a fallback case for a for loop which will run if the loop has zero length (for example, you loop over a collection that has no products). Learn more

{% for product in collection.products %}
  {{ product.title }}
{% else %}
  This collection is empty.
{% endfor %}
This collection is empty.

{% break %}

Causes the loop to stop iterating when it encounters the break tag. Learn more

{% for i in (1..5) %}
  {% if i == 4 %}
    {% break %}
  {% else %}
    {{ i }}
  {% endif %}
{% endfor %}
1 2 3

{% continue %}

Causes the loop to skip the current iteration when it encounters the continue tag. Learn more

{% for i in (1..5) %}
  {% if i == 4 %}
    {% continue %}
  {% else %}
    {{ i }}
  {% endif %}
{% endfor %}
1 2 3 5

{% cycle %}

Loops through a group of strings and outputs them in the order that they were passed as parameters. Each time cycle is called, the next string that was passed as a parameter is output. Learn more

{% cycle 'one', 'two', 'three' %}
{% cycle 'one', 'two', 'three' %}
{% cycle 'one', 'two', 'three' %}
{% cycle 'one', 'two', 'three' %}
one
two
three
one

{% paginate %}

Splits an array's items across multiple pages. Learn more

{% paginate array by page_size %}
  {% for item in array %}
    forloop_content
  {% endfor %}
{% endpaginate %}

{% tablerow %}

Generates an HTML <table>. Must be wrapped in an opening <table> and closing </table> HTML tags. Learn more

<table>
  {% tablerow product in collection.products %}
    {{ product.title }}
  {% endtablerow %}
</table>
<table>
  <tr class="row1">
    <td class="col1">
      Cool Shirt
    </td>
    <td class="col2">
      Alien Poster
    </td>
    <td class="col3">
      Batman Poster
    </td>
    <td class="col4">
      Bullseye Shirt
    </td>
    <td class="col5">
      Another Classic Vinyl
    </td>
    <td class="col6">
      Awesome Jeans
    </td>
  </tr>
</table>

Syntax Tags

Syntax tags control how Liquid code is processed and rendered. Learn more

{% comment %}

Prevents an expression from being rendered or output. Any text inside comment tags won't be output, and any Liquid code will be parsed, but not executed. Learn more

{% comment %}
  content
{% endcomment %}

{% echo %}

Outputs an expression. Learn more

{% echo product.title %}

{% liquid
  echo product.price | money
%}
Health potion

$10.00

{% liquid %}

Allows you to have a block of Liquid without delimeters on each tag. Learn more

{% liquid
  # Show a message that's customized to the product type

  assign product_type = product.type | downcase
  assign message = ''

  case product_type
    when 'health'
      assign message = 'This is a health potion!'
    when 'love'
      assign message = 'This is a love potion!'
    else
      assign message = 'This is a potion!'
  endcase

  echo message
%}
This is a health potion!

{% raw %}

Outputs any Liquid code as text instead of rendering it. Learn more

{% raw %}
  {{ 2 | plus: 2 }} equals 4.
{% endraw %}
{{ 2 | plus: 2 }} equals 4.

Theme Tags

Theme Tags have various functions including: outputting template-specific HTML markup, telling the theme which layout and snippets to use, and splitting a returned array into multiple pages. Learn more

{% include %}

Inserts a snippet from the snippets folder of a theme. Learn more

{% javascript %}

JavaScript code included in a section file. Learn more

{% javascript %}
  javascript_code
{% endjavascript %}

{% layout %}

Loads an alternate template file from the layout folder of a theme. If no alternate layout is defined, the theme.liquid template is loaded by default. Learn more

{% render %}

Renders a snippet from the snippets folder of a theme.

When a snippet is rendered, the code inside it does not have access to the variables assigned within its parent template. Similarly, variables assigned within the snippet can't be accessed by the code outside of the snippet. This encapsulation increases performance and helps make theme code easier to understand and maintain. Learn more

{% section %}

Inserts a section from the sections folder of a theme. Learn more

{% section 'footer' %}
<div id="shopify-section-footer" class="shopify-section">
  <!-- content of sections/footer.liquid -->
</div>

{% sections %}

Renders a section group. Use this tag to render section groups as part of the theme's layout content. Place the sections tag where you want to render it in the layout. Learn more

{% sections 'name' %}

{% stylesheet %}

CSS styles included in a section file. Learn more

{% stylesheet %}
  css_styles
{% endstylesheet %}

Variable Tags

Variable Tags are used to create new Liquid variables. Learn more

{% assign %}

Creates a new variable. Learn more

{% assign my_variable = false %}
{% if my_variable != true %}
  This statement is valid.
{% endif %}
This statement is valid.

{% capture %}

Captures the string inside of the opening and closing tags and assigns it to a variable. Variables created through {% capture %} are strings. Learn more

{% capture my_variable %}I am being captured.{% endcapture %}
{{ my_variable }}
I am being captured.

{% increment %}

Creates a new number variable, and increases its value by one every time it is called. The initial value is 0. Learn more

{% increment variable %}
{{ variable }}
{% increment variable %}
{{ variable }}
{% increment variable %}
{{ variable }}
0
1
2

{% decrement %}

Creates a new number variable and decreases its value by one every time it is called. The initial value is -1. Learn more

{% decrement variable %}
{{ variable }}
{% decrement variable %}
{{ variable }}
{% decrement variable %}
{{ variable }}
-1
-2
-3

Array Filters

Array filters are used to modify the output of arrays. Learn more

concat

Concatenates (combines) an array with another array. The resulting array contains all the elements of the original arrays. Learn more

{% assign fruits = "apples, oranges" | split: ", " %}
{% assign vegetables = "broccoli, carrots" | split: ", " %}
{% assign plants = fruits | concat: vegetables %}
{{ plants | join: ", " }}
apples, oranges, brocolli, carrots

join

Joins the elements of an array with the character passed as the parameter. The result is a single string. Learn more

{{ product.tags | join: ', ' }}
tag1, tag2, tag3

first

Returns the first element of an array. Learn more

<!-- product.tags = "sale", "mens", "womens", "awesome" -->
{{ product.tags | first }}
sale

index

Returns the item at the specified index in an array. Note that array numbering starts from zero, so the first item in an array is referenced with [0]. Learn more

<!-- product.tags = "sale", "mens", "womens", "awesome" -->
{{ product.tags[2] }}
womens

last

Gets the last element in an array. Learn more

<!-- product.tags = "sale", "mens", "womens", "awesome" -->
{{ product.tags | last }}
awesome

map

Accepts an array element’s attribute as a parameter and creates a string out of each array element’s value. Learn more

<!-- collections = {title: "Spring"}, {title: "Summer"} -->
{{ collections | map: 'title' }}
SpringSummer

reverse

Reverses the order of the items in an array. Learn more

{% assign my_array = "a, b, c, d" | split: ", " %}
{{ my_array | reverse | join: ", " }}
d, c, b, a

size

Returns the length of a string or an array. Learn more

{{ 'is this a 30 character string?' | size }}
30

sort

Sorts the elements of an array by a given attribute. Learn more

<!-- products = "a", "b", "A", "B" -->
{% assign products = collection.products | sort: 'title' %}
{% for product in products %}
   {{ product.title }}
{% endfor %}
A B a b

uniq

Removes any duplicate instances of elements in an array. Learn more

{% assign fruits = "orange apple banana apple orange" %}
{{ fruits | split: ' ' | uniq | join: ' ' }}
orange apple banana

where

Creates an array including only the objects with a given property value, or any truthy value by default. Learn more

All products:
{% for product in collection.products %}
- {{ product.title }}
{% endfor %}

{% assign kitchen_products = collection.products | where: "type", "kitchen" %}

Kitchen products:
{% for product in kitchen_products %}
- {{ product.title }}
{% endfor %}
All products:
- Vacuum
- Spatula
- Television
- Garlic press

Kitchen products:
- Spatula
- Garlic press

Cart Filters

Cart filters output or modify content specific to the cart object and its properties. Learn more

item_count_for_variant

Returns the total item count for a specified variant in the cart. Learn more

{{ cart | item_count_for_variant: 39888235757633 }}
1

Collection Filters

Collection filters output or modify content specific to the collection object and its properties. Learn more

highlight_active_tag

Wraps a given tag in an HTML span tag, with a class attribute of active, if the tag is currently active. Only applies to collection tags. Learn more

{% for tag in collection.all_tags %}
  {{- tag | highlight_active_tag | link_to_tag: tag }}
{% endfor %}
<a href="/services/liquid_rendering/extra-potent" title="Show products matching tag extra-potent"><span class="active">extra-potent</span></a>
<a href="/services/liquid_rendering/fresh" title="Show products matching tag fresh">fresh</a>
<a href="/services/liquid_rendering/healing" title="Show products matching tag healing">healing</a>

sort_by

Generates a collection URL with the provided sort_by parameter appended. This filter must be applied to a collection URL. Learn more

{{ collection.url | sort_by: 'best-selling' }}
/collections/sale-potions?sort_by=best-selling

url_for_type

Generates a URL for a collection page that lists all products of the given product type. Learn more

{{ 'Health' | url_for_type }}
/collections/types?q=health

url_for_vendor

Generates a URL for a collection page that lists all products from the given product vendor. Learn more

{{ "Polina's Potent Potions" | url_for_vendor }}
/collections/vendors?q=Polina%27s%20Potent%20Potions

within

Generates a product URL within the context of the provided collection. Learn more

{%- assign collection_product = collection.products.first -%}
{{ collection_product.url | within: collection }}
/collections/sale-potions/products/draught-of-immortality

Color Filters

Color filters change or extract properties from CSS color strings. These filters are commonly used with color theme settings. Learn more

brightness_difference

Calculates the perceived brightness difference between two colors. With regards to accessibility, the W3C suggests that the brightness difference should be greater than 125. Learn more

{{ '#fff00f' | brightness_difference: '#0b72ab' }}
129

color_brightness

Calculates the perceived brightness of the given color. Learn more

{{ '#7ab55c' | color_brightness }}
153.21

color_contrast

Calculates the contrast ratio between two colors. Returns the numerator part of the ratio, which has a denominator of 1. For example, for a contrast ratio of 3.5:1, the filter returns 3.5. Learn more

{{ '#495859' | color_contrast: '#fffffb' }}
7.4

color_darken

Darkens the input color. Takes a value between 0 and 100 percent. Learn more

{{ '#7ab55c' | color_darken: 30 }}
#355325

color_desaturate

Desaturates the input color. Takes a value between 0 and 100 percent. Learn more

{{ '#7ab55c' | color_desaturate: 30 }}
#869180

color_difference

Calculates the color difference or distance between two colors. With regards to accessibility, the W3C suggests that the color difference should be greater than 500. Learn more

{{ '#ff0000' | color_difference: '#abcdef' }}
528

color_extract

Extracts a component from the color. Valid components are alpha, red, green, blue, hue, saturation and lightness. Learn more

{{ '#7ab55c' | color_extract: 'red' }}
122

color_lighten

Lightens the input color. Takes a value between 0 and 100 percent. Learn more

{{ '#7ab55c' | color_lighten: 30 }}
#d0e5c5

color_mix

Blends together two colors. Blend factor should be a value between 0 and 100 percent. Learn more

{{ '#7ab55c' | color_mix: '#ffc0cb', 50 }}
#bdbb94

color_modify

Modifies the given component of a color (rgb, alpha, hue and saturation). The filter will return a color type that includes the modified format — for example, if you modify the alpha channel, the filter will return the color in rgba() format, even if your input color was in hex format. Learn more

{{ '#7ab55c' | color_modify: 'red', 255 }}
{{ '#7ab55c' | color_modify: 'alpha', 0.85 }}
#ffb55c
rgba(122, 181, 92, 0.85)

color_saturate

Saturates the input color. Takes a value between 0 and 100 percent. Learn more

{{ '#7ab55c' | color_saturate: 30 }}
#6ed938

color_to_rgb

Converts a CSS color string to CSS rgb() format. If the input color has an alpha component, then the output will be in CSS rgba() format. Learn more

{{ '#7ab55c' | color_to_rgb }}
{{ 'hsla(100, 38%, 54%, 0.5)' | color_to_rgb }}
rgb(122, 181, 92)
rgba(122, 181, 92, 0.5)

color_to_hsl

Converts a CSS color string to CSS hsl() format. If the input color has an alpha component, then the output will be in CSS hsla() format. Learn more

{{ '#7ab55c' | color_to_hsl }}
{{ 'rgba(122, 181, 92, 0.5)' | color_to_hsl }}
hsl(100, 38%, 54%)
hsla(100, 38%, 54%, 0.5)

color_to_hex

Converts a CSS color string to hex6 format. Hex output is always in hex6 format. If there is an alpha channel in the input color, it will not appear in the output. Learn more

{{ 'rgb(122, 181, 92)' | color_to_hex }}
{{ 'rgba(122, 181, 92, 0.5)' | color_to_hex }}
#7ab55c
#7ab55c

Customer Filters

Customer filters output URLs that enable customers to interact with their account in the store. Learn more

customer_login_link

Generates an HTML link to the customer login page. Learn more

{{ 'Log in' | customer_login_link }}
<a href="/account/login" id="customer_login_link">Log in</a>

customer_logout_link

Generates an HTML link to log the customer out of their account and redirect to the homepage. Learn more

{{ 'Log out' | customer_logout_link }}
<a href="/account/logout" id="customer_logout_link">Log out</a>

customer_register_link

Generates an HTML link to the customer register page. Learn more

{{ 'Create an account' | customer_register_link }}
<a href="/account/register" id="customer_register_link">Create an account</a>

login_button

Generates an HTML Button that enables a customer to follow the Shop in the Shop App. Learn more

{{ shop | login_button: action: 'follow' }}

Default Filters

Default filters enable you to use or set default values for certain contexts. Learn more

default

Sets a default value for any variable whose value is either empty, false or nil. Learn more

{{ product.selected_variant.url | default: product.url }}
/products/health-potion

default_errors

Generates default error messages for each possible value of form.errors. Learn more

default_pagination

Generates HTML for a set of links for paginated results. Must be applied to the paginate object. Learn more

{% paginate collection.products by 2 %}
  {% for product in collection.products %}
    {{- product.title }}
  {% endfor %}
  {{- paginate | default_pagination -}}
{% endpaginate %}
Draught of Immortality
Glacier ice

  <span class="page current">1</span> <span class="page"><a href="/services/liquid_rendering/resource?page=2" title="">2</a></span> <span class="next"><a href="/services/liquid_rendering/resource?page=2" title="">Next &raquo;</a></span>

Font Filters

Font filters are called on font objects. You can use font filters to load fonts or to obtain font variants. Learn more

font_face

Returns a CSS @font-face declaration to load the chosen font. Learn more

<style>
  {{ settings.heading_font | font_face }}
</style>
<style>
  @font-face {
    font-family: "Neue Haas Unica";
    font-weight: 400;
    font-style: normal;
    src: url("https://fonts.shopifycdn.com/neue_haas_unica/neuehaasunica_n4.8a2375506d3dfc7b1867f78ca489e62638136be6.woff2?hmac=d5feff0f2e6b37fedb3ec099688181827df4a97f98d2336515503215e8d1ff55&host=c2hvcDEubXlzaG9waWZ5Lmlv") format("woff2"),
        url("https://fonts.shopifycdn.com/neue_haas_unica/neuehaasunica_n4.06cdfe33b4db0659278e9b5837a3e8bc0a9d4025.woff?hmac=d5feff0f2e6b37fedb3ec099688181827df4a97f98d2336515503215e8d1ff55&host=c2hvcDEubXlzaG9waWZ5Lmlv") format("woff");
  }
</style>

font_modify

font_modify takes two arguments. The first indicates which property should be modified and the second is the modification to be made. While you can access every variant of the chosen font's family by using font.variants, you can more easily access specific styles and weights by using the font_modify filter. Learn more

{% assign bold_font = settings.body_font | font_modify: 'weight', 'bold' %}
h2 {
  font-weight: {{ bolder_font.weight }};
}
h2 {
  font-weight: 900;
}

font_url

Returns a CDN URL for the chosen font. By default, font_url returns the woff2 version, but it can also be called with an additional parameter to specify the format. Both woff and woff2 are supported. Learn more

{{ settings.type_header_font | font_url }}
{{ settings.type_base_font | font_url: 'woff' }}
https://fonts.shopifycdn.com/neue_haas_unica/neuehaasunica_n4.8a2375506d3dfc7b1867f78ca489e62638136be6.woff2?...9waWZ5Lmlv
https://fonts.shopifycdn.com/work_sans/worksans_n6.399ae4c4dd52d38e3f3214ec0cc9c61a0a67ea08.woff?...b63d5ca77de58c7a23ece904

Format Filters

Format filters apply formats to specific data types. Learn more

date

Converts a timestamp into another date format. Learn more

{{ article.created_at | date: '%B %d, %Y' }}
April 14, 2022

json

Converts a string, or object, into JSON format. Learn more

{{ product | json }}

weight_with_unit

Generates a formatted weight for a variant object. The weight unit is set in the general settings in the Shopify admin. Learn more

{%- assign variant = product.variants.first -%}
{{ variant.weight | weight_with_unit }}
0.2 kg

HTML Filters

HTML filters wrap assets in HTML tags. Learn more

highlight

Wraps all instances of a specific string, within a given string, with an HTML strong tag with a class attribute of highlight. Learn more

{% for item in search.results %}
  {% if item.object_type == 'product' %}
    {{ item.description | highlight: search.terms }}
  {% else %}
    {{ item.content | highlight: search.terms }}
  {% endif %}
{% endfor %}
This is a <strong class="highlight">love</strong> potion.

placeholder_svg_tag

Generates an HTML tag for a given placeholder name. Learn more

{{ 'collection-1' | placeholder_svg_tag }}

preload_tag

Generates an HTML link tag with a rel attribute of preload to prioritize loading a given Shopify-hosted asset. Learn more

{{ 'cart.js' | asset_url | preload_tag: as: 'script' }}
<link href="//polinas-potent-potions.myshopify.com/cdn/shop/t/4/assets/cart.js?v=83971781268232213281663872410" rel="preload" as="script" rel="preload">

script_tag

Generates a script tag. Learn more

{{ 'shop.js' | asset_url | script_tag }}
<script src="//cdn.shopify.com/s/files/1/0087/0462/t/394/assets/shop.js?28178" type="text/javascript"></script>

stylesheet_tag

Generates a link tag that points to the given stylesheet. Learn more

{{ 'shop.css' | asset_url | stylesheet_tag }}
<link href="//cdn.shopify.com/s/files/1/0087/0462/t/394/assets/shop.css?28178" rel="stylesheet" type="text/css" media="all" />

time_tag

The time_tag filter converts a timestamp into an HTML <time> tag. The output format can be customized by passing date parameters to the time_tag filter. Learn more

{{ article.published_at | time_tag }}
{{ article.published_at | time_tag: '%a, %b %d, %Y' }}
<time datetime="2016-02-24T14:47:51Z">Wed, 24 Feb 2016 09:47:51 -0500</time>
<time datetime="2016-02-24T14:47:51Z">Wed, Feb 24, 2016</time>

Hosted file Filters

Hosted file filters return URLs for assets hosted on the Shopify CDN, including files uploaded in the Shopify admin. Learn more

asset_img_url

Returns the CDN URL for an image in the assets directory of a theme. Learn more

{{ 'red-and-black-bramble-berries.jpg' | asset_img_url }}
//polinas-potent-potions.myshopify.com/cdn/shop/t/4/assets/red-and-black-bramble-berries_small.jpg?315

asset_url

Returns the CDN URL for a file in the assets directory of a theme. Learn more

{{ 'cart.js' | asset_url }}
//polinas-potent-potions.myshopify.com/cdn/shop/t/4/assets/cart.js?v=83971781268232213281663872410

file_img_url

Returns the CDN URL for an image in the Files page of the Shopify admin. Learn more

{{ 'potions-header.png' | file_img_url }}
//polinas-potent-potions.myshopify.com/cdn/shop/files/potions-header_small.png?v=4246568442683817558

file_url

Returns the CDN URL for a file from the Files page of the Shopify admin. Learn more

{{ 'disclaimer.pdf' | file_url }}
//polinas-potent-potions.myshopify.com/cdn/shop/files/disclaimer.pdf?v=9043651738044769859

global_asset_url

Returns the CDN URL for a global asset. Learn more

{{ 'lightbox.js' | global_asset_url | script_tag }}
<script src="//polinas-potent-potions.myshopify.com/cdn/s/global/lightbox.js" type="text/javascript"></script>

shopify_asset_url

Returns the CDN URL for a globally accessible Shopify asset. Learn more

{{ 'option_selection.js' | shopify_asset_url }}
//polinas-potent-potions.myshopify.com/cdn/shopifycloud/shopify/assets/themes_support/option_selection-9f517843f664ad329c689020fb1e45d03cac979f64b9eb1651ea32858b0ff452.js

Localization Filters

Localization filters enable you to customize the language and format of elements according to the customer’s locale. Learn more

currency_selector

Generates an HTML select element with an option for each currency available on the store. Learn more

{% form 'currency' %}
  {{ form | currency_selector }}
{% endform %}
<form method="post" action="/cart/update" id="currency_form" accept-charset="UTF-8" class="shopify-currency-form" enctype="multipart/form-data"><input type="hidden" name="form_type" value="currency" /><input type="hidden" name="utf8" value="✓" /><input type="hidden" name="return_to" value="/services/liquid_rendering/resource" />
  <select name="currency"><option value="AED">AED د.إ</option><option value="AFN">AFN ؋</option><option value="AUD">AUD $</option><option value="CAD" selected="selected">CAD $</option><option value="CHF">CHF CHF</option><option value="CZK">CZK Kč</option><option value="DKK">DKK kr.</option><option value="EUR">EUR €</option><option value="GBP">GBP £</option><option value="HKD">HKD $</option><option value="ILS">ILS ₪</option><option value="JPY">JPY ¥</option><option value="KRW">KRW ₩</option><option value="MYR">MYR RM</option><option value="NZD">NZD $</option><option value="PLN">PLN zł</option><option value="SEK">SEK kr</option><option value="SGD">SGD $</option><option value="USD">USD $</option></select>
</form>

format_address

Generates an HTML address display, with each address component ordered according to the address's locale. Learn more

{{ shop.address | format_address }}
<p>Polina's Potions, LLC<br>150 Elgin Street<br>8th floor<br>Ottawa ON K2P 1L4<br>Canada</p>

t (translate)

Returns a string of translated text for a given translation key from a locale file. The translate filter has an alias of t, which is more commonly used. Learn more

Math Filters

Math filters can be linked and are applied in order from left to right, as with all other filters Learn more

abs

Returns the absolute value of a number or string that onnly contains a number. Learn more

{{ -24 | abs }}
{{ "-1.23" | abs }}
24
1.23

at_least

Limits a number to a minimum value. Learn more

{{ 2 | at_least: 5 }}
{{ 2 | at_least: 1 }}
5
2

at_most

Limits a number to a maximum value. Learn more

{{ 2 | at_most: 5 }}
{{ 2 | at_most: 1 }}
2
1

ceil

Rounds an output up to the nearest integer. Learn more

{{ 4.6 | ceil }}
{{ 4.3 | ceil }}
5
5

divided_by

Divides an output by a number. The output is rounded down to the nearest integer. Learn more

<!-- product.price = 200 -->
{{ product.price | divided_by: 10 }}
20

floor

Rounds an output down to the nearest integer. Learn more

{{ 4.6 | floor }}
{{ 4.3 | floor }}
4
4

minus

Subtracts a number from an input. Learn more

<!-- product.price = 200 -->
{{ product.price | minus: 15 }}
185

plus

Adds a number to an output. Learn more

<!-- product.price = 200 -->
{{ product.price | plus: 15 }}
215

round

Rounds the output to the nearest integer or specified number of decimals. Learn more

{{ 4.6 | round }}
{{ 4.3 | round }}
{{ 4.5612 | round: 2 }}
5
4
4.56

times

Multiplies an output by a number. Learn more

<!-- product.price = 200 -->
{{ product.price | times: 1.15 }}
230

modulo

Divides an output by a number and returns the remainder. Learn more

{{ 12 | modulo:5 }}
2

Media Filters

Media filters let you generate URLs for a product's media. Learn more

external_video_tag

Generates an IFrame that contains a YouTube video player. Learn more

{% if product.featured_media.media_type == "external_video" %}
  {{ product.featured_media | external_video_tag }}
{% endif %}
<iframe frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen="allowfullscreen" src="https://www.youtube.com/embed/neFK-pv2sKY?controls=1&amp;enablejsapi=1&amp;modestbranding=1&amp;playsinline=1&amp;rel=0">
  ...
</iframe>

external_video_url

Used to set parameters for the YouTube player rendered by external_video_tag. Learn more

{% if product.featured_media.media_type == "external_video" %}
  {{ product.featured_media | external_video_url: color: "white" |  external_video_tag }}
{% endif %}
<iframe frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen="allowfullscreen" src="https://www.youtube.com/embed/neFK-pv2sKY?color=white&amp;controls=1&amp;enablejsapi=1&amp;modestbranding=1&amp;playsinline=1&amp;rel=0">
  ...
</iframe>

img_tag

When used with a model or a video object, the img_tag filter generates an image tag for the media's preview image. Learn more

{% if product.featured_media.media_type == "model" %}
  {{ product.featured_media | img_tag }}
{% endif %}
<img src="//cdn.shopify.com/s/files/1/1425/8696/products/b15ddb43cbac45b1ae2685223fa3536d_small.jpg?v=1560284062">

img_url

When used with a media object, the img_url filter generates an image URL for the media's preview image. Learn more

{% if product.featured_media.media_type == "video" %}
  {{ product.featured_media | img_url: '500x500' }}
  {{ product.featured_media | img_url }}
{% endif %}
//cdn.shopify.com/s/files/1/1425/8696/products/b15ddb43cbac45b1ae2685223fa3536d_500x500.jpg?v=1560284062
//cdn.shopify.com/s/files/1/1425/8696/products/b15ddb43cbac45b1ae2685223fa3536d_small.jpg?v=1560284062

media_tag

Generates an appropriate tag for the media. Learn more

{% if product.featured_media.media_type == "model" %}
  {{ product.featured_media | media_tag }}
{% endif %}
<model-viewer src="https://model3d.shopifycdn.com/models/o/0029ee870c5c3cdd/stroller.glb" ios-src="https://model3d.shopifycdn.com/models/o/0029ee870c5c3cdd/stroller.usdz" poster="//cdn.shopify.com/s/files/1/1425/8696/products/placeholder_image_small.jpg?v=1560284071" camera-controls="true">
  ...
</model-viewer>

model_viewer_tag

Generates a Google model viewer component tag for the given 3D model. Learn more

{% if product.featured_media.media_type == "model" %}
  {{ product.featured_media | model_viewer_tag }}
{% endif %}
<model-viewer src="https://model3d.shopifycdn.com/models/o/0029ee870c5c3cdd/stroller.glb" ios-src="https://model3d.shopifycdn.com/models/o/0029ee870c5c3cdd/stroller.usdz" poster="//cdn.shopify.com/s/files/1/1425/8696/products/placeholder_image_small.jpg?v=1560284071" camera-controls="true">
  ...
</model-viewer>

video_tag

Generates a video tag. Learn more

{% if product.featured_media.media_type == "video" %}
  {{ product.featured_media | video_tag }}
{% endif %}
<video playsinline="true" controls="">
  <source src="https://videos.shopifycdn.com/c/vp/afe4b8a92ca944e49bc4b888927b7ec3/master.m3u8?Expires=1560458164&amp;KeyName=core-signing-key-1&amp;Signature=BIQQpuyEVnyt9HUw4o9QOmQ1z2c=" type="application/x-mpegURL">
  <source src="https://videos.shopifycdn.com/c/vp/afe4b8a92ca944e49bc4b888927b7ec3/SD-360p.mp4?Expires=1560458164&amp;KeyName=core-signing-key-1&amp;Signature=1kEi8GmNIssxVvjyzy7AOuGP-E0=" type="video/mp4">
  <source src="https://videos.shopifycdn.com/c/vp/afe4b8a92ca944e49bc4b888927b7ec3/SD-480p.mp4?Expires=1560458164&amp;KeyName=core-signing-key-1&amp;Signature=8Lt74XmFWP6hOF1WRdqNkDWRm2U=" type="video/mp4">
  <source src="https://videos.shopifycdn.com/c/vp/afe4b8a92ca944e49bc4b888927b7ec3/HD-720p.mp4?Expires=1560458164&amp;KeyName=core-signing-key-1&amp;Signature=vlNXWpvgRT2bghrWovJPrN8w3mc=" type="video/mp4"><p>Sorry html5 video is not supported in this browser</p>
</video>

Metafield Filters

Metafield filters can output metafield data from a metafield object within a relevant HTML element, or as a plain string. Learn more

metafield_tag

Generates an HTML element depending on the type of metafield. Learn more

{{ product.metafields.instructions.wash | metafield_tag }}
<!-- if single_line_text_field metafields output the text inside a <span> element with an attribute of class="metafield-single_line_text_field". -->
<span class="metafield-single_line_text_field">This is a single line of text.</span>

metafield_text

Generates a text version of the metafield data. Learn more

{{ product.metafields.instructions.wash | metafield_text }}

Money Filters

Money filters format prices based on the Currency Formatting found in General Settings. Learn more

money

Formats the price based on the shop’s ‘HTML without currency’ setting. Learn more

{{ 145 | money }}
<!-- if "HTML without currency" is ${{ amount }} -->
$1.45
<!-- if "HTML without currency" is €{{ amount_no_decimals }} -->
$1

money_with_currency

Formats the price based on the shop’s ‘HTML with currency’ setting. Learn more

{{ 1.45 | money_with_currency }}
<!-- if "HTML with currency" is ${{ amount }} CAD --> $1.45 CAD

money_without_trailing_zeros

Formats the price based on the shop’s ‘HTML with currency’ setting and excludes the decimal point and trailing zeros. Learn more

<!-- if "HTML with currency" is ${{ amount }} CAD -->
{{ 20.00 | money_without_trailing_zeros }}
$20

money_without_currency

Formats the price using a decimal. Learn more

{{ 1.45 | money_without_currency }}
1.45

Payment Filters

Payment filters output content related to the store’s payment options. Learn more

payment_button

Generates an HTML container to host dynamic checkout buttons for a product. Learn more

{% form 'product', product %}
  {{ form | payment_button }}
{% endform %}
<form method="post" action="/cart/add" id="product_form_6786188247105" accept-charset="UTF-8" class="shopify-product-form" enctype="multipart/form-data"><input type="hidden" name="form_type" value="product" /><input type="hidden" name="utf8" value="✓" />
  <div data-shopify="payment-button" data-has-selling-plan="true" data-has-fixed-selling-plan="false" class="shopify-payment-button"><button class="shopify-payment-button__button shopify-payment-button__button--unbranded shopify-payment-button__button--hidden" disabled="disabled" aria-hidden="true"> </button><button class="shopify-payment-button__more-options shopify-payment-button__button--hidden" disabled="disabled" aria-hidden="true"> </button></div>
</form>

payment_terms

Generates the HTML for the Shop Pay Installments banner. Learn more

{% form 'product', product %}
  {{ form | payment_terms }}
{% endform %}

payment_type_img_url

Returns the URL for an SVG image of a given payment type. Learn more

{% for type in shop.enabled_payment_types %}
  <img src="{{ type | payment_type_img_url }}" />
{% endfor %}
<img src="//polinas-potent-potions.myshopify.com/cdn/shopifycloud/shopify/assets/payment_icons/american_express-2264c9b8b57b23b0b0831827e90cd7bcda2836adc42a912ebedf545dead35b20.svg" />

payment_type_svg_tag

Generates an HTML SVG tag for a given payment type. Learn more

{% for type in shop.enabled_payment_types -%}
  {{ type | payment_type_svg_tag }}
{% endfor %}

String Filters

String filters are used to manipulate outputs and variables of the string type. Learn more

append

Appends characters to a string. Learn more

{{ 'sales' | append: '.jpg' }}
sales.jpg

camelcase

Converts a dash-separated string into CamelCase. Learn more

{{ 'coming-soon' | camelcase }}
ComingSoon

capitalize

Capitalizes the first word in a string. Learn more

{{ 'capitalize me' | capitalize }}
Capitalize me

downcase

Converts a string into lowercase. Learn more

{{ 'UPPERCASE' | downcase }}
uppercase

escape

Escapes a string. Learn more

{{ "<p>test</p>" | escape }}
<p>test</p>

handleize

Formats a string into a handle. Learn more

{{ '100% M & Ms!!!' | handleize }}
100-m-ms

hmac_sha1

Converts a string into a SHA-1 hash using a hash message authentication code (HMAC). Pass the secret key for the message as a parameter to the filter. Learn more

{% assign my_secret_string = "ShopifyIsAwesome!" | hmac_sha1: "secret_key" %}
 My encoded string is: {{ my_secret_string }}
My encoded string is: 30ab3459e46e7b209b45dba8378fcbba67297304

hmac_sha256

Converts a string into a SHA-256 hash using a hash message authentication code (HMAC). Pass the secret key for the message as a parameter to the filter. Learn more

{% assign my_secret_string = "ShopifyIsAwesome!" | hmac_sha256: "secret_key" %}
My encoded string is: {{ my_secret_string }}
My encoded string is: 30ab3459e46e7b209b45dba8378fcbba67297304

md5

Converts a string into an MD5 hash. Learn more

<img src="https://www.gravatar.com/avatar/{{ comment.email | remove: ' ' | strip_newlines | downcase | md5 }}" />
<img src="https://www.gravatar.com/avatar/2a95ab7c950db9693c2ceb767784c201" />

newline_to_br

Inserts a <br> linebreak HTML tag in front of each line break in a string. Learn more

{% capture var %}
One
Two
Three
{% endcapture %}
{{ var | newline_to_br }}
One<br>
Two<br>
Three<br>

pluralize

Outputs the singular or plural version of a string based on the value of a number. The first parameter is the singular string and the second parameter is the plural string. Learn more

{{ cart.item_count | pluralize: 'item', 'items' }}
3 items

prepend

Prepends characters to a string. Learn more

{{ 'sale' | prepend: 'Made a great ' }}
Made a great sale

remove

Removes all occurrences of a substring from a string. Learn more

{{ "Hello, world. Goodbye, world." | remove: "world" }}
Hello, . Goodbye, .

remove_first

Removes only the first occurrence of a substring from a string. Learn more

{{ "Hello, world. Goodbye, world." | remove_first: "world" }}
Hello, . Goodbye, world.

replace

Replaces all occurrences of a substring with a string. Learn more

<!-- product.title = "Awesome Shoes" -->
{{ product.title | replace: 'Awesome', 'Mega' }}
Mega Shoes

replace_first

Replaces the first occurrence of a substring with a string. Learn more

<!-- product.title = "Awesome Awesome Shoes" -->
{{ product.title | replace_first: 'Awesome', 'Mega' }}
Mega Awesome Shoes

slice

The slice filter returns a substring, starting at the specified index. An optional second parameter can be passed to specify the length of the substring. If no second parameter is given, a substring of one character will be returned. Learn more

{{ "hello" | slice: 0 }}
{{ "hello" | slice: 1 }}
{{ "hello" | slice: 1, 3 }}
h
e
ell

split

The split filter takes on a substring as a parameter. The substring is used as a delimiter to divide a string into an array. You can output different parts of an array using array filters. Learn more

{% assign words = "Hi, how are you today?" | split: ' ' %}
{% for word in words %}
{{ word }}
{% endfor %}
Hi,
how
are
you
today?

strip

Strips tabs, spaces, and newlines (all whitespace) from the left and right side of a string. Learn more

{{ '   too many spaces      ' | strip }}
too many spaces

lstrip

Strips tabs, spaces, and newlines (all whitespace) from the left side of a string. Learn more

"{{ '   too many spaces           ' | lstrip }}"
<!-- Notice the empty spaces to the right of the string -->
"too many spaces           "

reverse

reverse cannot be used directly on a string, but you can split a string into an array, reverse the array, and rejoin it by chaining together other filters. Learn more

{{ "Ground control to Major Tom." | split: "" | reverse | join: "" }}
.moT rojaM ot lortnoc dnuorG

rstrip

Strips tabs, spaces, and newlines (all whitespace) from the right side of a string. Learn more

{{ '              too many spaces      ' | rstrip }}
"                too many spaces"

sha1

Converts a string into a SHA-1 hash. Learn more

{% assign my_secret_string = "ShopifyIsAwesome!" | sha1 %}
My encoded string is: {{ my_secret_string }}
My encoded string is: c7322e3812d3da7bc621300ca1797517c34f63b6

sha256

Converts a string into a SHA-256 hash. Learn more

{% assign my_secret_string = "ShopifyIsAwesome!" | sha256 %}
My encoded string is: {{ my_secret_string }}
My encoded string is: c29cce758876791f34b8a1543f0ec3f8e886b5271004d473cfe75ac3148463cb

strip_html

Strips all HTML tags from a string. Learn more

{{ "<h1>Hello</h1> World" | strip_html }}
Hello World

strip_newlines

Removes any line breaks/newlines from a string. Learn more

<!-- product.description = "This is a multiline\nproduct description."
{{ product.description | strip_newlines }}
This is a multiline product description.

truncate

Truncates a string down to ‘x’ characters, where x is the number passed as a parameter. An ellipsis (...) is appended to the string and is included in the character count. Learn more

{{ "The cat came back the very next day" | truncate: 10 }}
The cat...

truncatewords

Truncates a string down to ‘x’ words, where x is the number passed as a parameter. An ellipsis (...) is appended to the truncated string. Learn more

{{ "The cat came back the very next day" | truncatewords: 4 }}
The cat came back...

upcase

Converts a string into uppercase. Learn more

{{ 'i want this to be uppercase' | upcase }}
I WANT THIS TO BE UPPERCASE

url_encode

Converts any URL-unsafe characters in a string into percent-encoded characters. Learn more

{{ "john@liquid.com" | url_encode }}
john%40liquid.com

url_escape

Identifies all characters in a string that are not allowed in URLS, and replaces the characters with their escaped variants. Learn more

{{ "<hello> & <shopify>" | url_escape }}
%3Chello%3E%20&%20%3Cshopify%3E

url_param_escape

Replaces all characters in a string that are not allowed in URLs with their escaped variants, including the ampersand (&). Learn more

{{ "<hello> & <shopify>" | url_param_escape }}
%3Chello%3E%20%26%20%3Cshopify%3E

additional_checkout_buttons

Returns true if a store has any payment providers with offsite checkouts, such as PayPal Express Checkout. Use additional_checkout_buttons to check whether these payment providers exist, and content_for_additional_checkout_buttons to show the associated checkout buttons. Learn more

additional_checkout_buttons

Returns true if a store has any payment providers with offsite checkouts, such as PayPal Express Checkout. Learn more

{% if additional_checkout_buttons %}
  {{ content_for_additional_checkout_buttons }}
{% endif %}

address

The address object contains information entered by a customer in Shopify’s checkout pages. Note that a customer can enter two addresses: billing address or shipping address. When accessing attributes of the address object, you must specify which address you want to target. This is done by using either shipping_address or billing_address before the attribute. Learn more

address.name

Returns the values of the First Name and Last Name fields of the address. Learn more

Hello, {{ billing_address.name }}

address.first_name

Returns the value of the First Name field of the address. Learn more

address.last_name

Returns the value of the Last Name field of the address. Learn more

address.address1

Returns the value of the Address1 field of the address. Learn more

address.address2

Returns the value of the Address2 field of the address. Learn more

address.street

Returns the combined values of the Address1 and Address2 fields of the address. Learn more

{{ shipping_address.street }}

address.company

Returns the value of the Company field of the address. Learn more

address.city

Returns the value of the City field of the address. Learn more

address.province

Returns the value of the Province/State field of the address. Learn more

address.province_code

Returns the abbreviated value of the Province/State field of the address. Learn more

address.zip

Returns the value of the Postal/Zip field of the address. Learn more

address.country

Returns the value of the Country field of the address. Learn more

address.country_code

Returns the value of the Country field of the address in ISO 3166-2 standard format. Learn more

address.phone

Returns the value of the Phone field of the address. Learn more

all_country_option_tags

The all_country_option_tags object creates an option tag for each country. An attribute called data-provinces is set for each option, and contains a JSON-encoded array of the country's subregions. If a country doesn't have any subregions, then an empty array is set for its data-provinces attribute. Learn more

all_country_option_tags

The all_country_option_tags object should be wrapped in select tags. Learn more

<select name="country">
  {{ all_country_option_tags }}
</select>
<select name="country">
  <option value="---" data-provinces="[]">---</option>
  <option value="Afghanistan" data-provinces="[]">Afghanistan</option>
  <option value="Aland Islands" data-provinces="[]">Åland Islands</option>
  ...
  <option value="Canada" data-provinces="[['Alberta','Alberta'],['British Columbia','British Columbia'],['Manitoba','Manitoba'],['New Brunswick','New Brunswick'],['Newfoundland','Newfoundland'],['Northwest Territories','Northwest Territories'],['Nova Scotia','Nova Scotia'],['Nunavut','Nunavut'],['Ontario','Ontario'],['Prince Edward Island','Prince Edward Island'],['Quebec','Quebec'],['Saskatchewan','Saskatchewan'],['Yukon','Yukon']]">Canada</option>
  ...
</select>

all_products

All of the products on a store. Learn more

all_products

You can use all_products to access a product by its handle. If the product isn't found, then nil is returned. Learn more

{{ all_products['love-potion'].title }}
Love Potion

app

An app. This object is usually used to access app-specific information for use with theme app extensions. Learn more

app.metafields

The metafields that are owned by the app. Learn more

article

The article object. Learn more

article.author

Returns the full name of the article’s author. Learn more

article.comments

Returns the published comments of an article. Returns an empty array if comments are disabled. Learn more

article.comments_count

Returns the number of published comments for an article. Learn more

article.comments_enabled?

Returns true if comments are enabled. Returns false if comments are disabled. Learn more

article.comment_post_url

Returns the relative URL where POST requests are sent to when creating new comments. Learn more

article.content

Returns the content of an article. Learn more

article.created_at

Returns the timestamp of when an article was created. Use the date filter to format the timestamp. Learn more

{{ article.created_at | date: "%a, %b %d, %y" }}
Fri, Sep 16, 11

article.excerpt

Returns the excerpt of an article. Learn more

article.excerpt_or_content

Returns article.excerpt of the article if it exists. Returns article.content if an excerpt does not exist for the article. Learn more

article.handle

Returns the handle of the article. Learn more

article.id

Returns the id of an article. Learn more

article.image

Returns the article image. Use the img_url filter to link it to the image file on the Shopify CDN. Check for the presence of the image first. Learn more

{% if article.image %}
  {{ article | img_url: 'medium' }}
{% endif %}

article.image.alt

Returns the article image's alt text. Learn more

article.image.src

Returns the relative URL to the article image. Learn more

{{ article.image.src | img_url: 'medium' }}

article.moderated?

Returns true if the blog that the article belongs to is set to moderate comments. Returns false if the blog is not moderated. Learn more

article.published_at

Returns the date/time when an article was published. Use the date filter to format the timestamp. Learn more

article.tags

Returns all the tags for an article. Learn more

{% for tag in article.tags %}
  {{ tag }}
{% endfor %}

article.updated_at

Returns returns a timestamp for when a blog article was updated. The date filter can be applied to format the timestamp. Learn more

article.url

Returns the relative URL of the article. Learn more

article.user

Returns an object with information about the article's author. This information can be edited in the Staff accounts options on the Account page in the Shopify admin. Learn more

articles

All of the articles across the blogs in the store. Learn more

articles

All of the articles across the blogs in the store. You can use articles to access an article by its handle. Learn more

{% assign article = articles['potion-notions/new-potions-for-spring'] %}
  {{ article.title | link_to: article.url }}
<a href="/blogs/potion-notions/new-potions-for-spring" title="">New potions for spring</a>

block

A block represents the content and settings of a single block in an array of section blocks. The block object can be accessed in a section file by looping through section.blocks. Learn more

block.id

Returns a unique ID dynamically generated by Shopify. Learn more

block.settings

Returns an object of the block settings set in the theme editor. Retrieve setting values by referencing the setting's unique id. Learn more

block.shopify_attributes

Returns a string representing the block's attributes. The theme editor's JavaScript API uses a block's shopify_attributes to identify blocks and listen for events. No value for block.shopify_attributes is returned outside the theme editor. Learn more

block.type

Returns the type defined in the block's schema. This is useful for displaying different markup based on the block.type. Learn more

blog

The blog object. Learn more

blog.all_tags

Returns all tags of all articles of a blog. This includes tags of articles that are not in the current pagination view. Learn more

{% for tag in blog.all_tags %}
  {{ tag }}
{% endfor %}

blog.articles

Returns an array of all articles in a blog. Learn more

{% for article in blog.articles %}
  <h2>{{ article.title }}</h2>
{% endfor %}

blog.articles_count

Returns the total number of articles in a blog. This total does not include hidden articles. Learn more

blog.comments_enabled?

Returns true if comments are enabled. Returns false if comments are disabled. Learn more

blog.handle

Returns the handle of the blog. Learn more

blog.id

Returns the id of the blog. Learn more

blog.moderated?

Returns true if comments are moderated, or false if they are not moderated. Learn more

blog.next_article

Returns the URL of the next (older) post. Returns false if there is no next article. Learn more

blog.previous_article

Returns the URL of the previous (newer) post. Returns false if there is no next article. Learn more

blog.tags

Returns all tags in a blog. Similar to all_tags, but only returns tags of articles that are in the filtered view. Learn more

blog.title

Returns the title of the blog. Learn more

blog.url

Returns the relative URL of the blog. Learn more

blogs

All of the blogs in the store. Learn more

blogs

Allows you to access all of the blogs in the store. You can use blogs to access a blog by its handle. Learn more

{% for article in blogs.potion-notions.title %}
  {{ article.title | link_to: article.url }}
{% endfor %}
<a href="/blogs/potion-notions/homebrew-start-making-potions-at-home" title="">Homebrew: start making potions at home</a>
<a href="/blogs/potion-notions/new-potions-for-spring" title="">New potions for spring</a>
<a href="/blogs/potion-notions/how-to-tell-if-you-have-run-out-of-invisibility-potion" title="">How to tell if you're out of invisibility potion</a> 

brand

The brand assets for the store. Learn more

brand.colors

The brand's colors. To learn about how to access brand colors, refer to brand_color. Learn more

brand.cover_image

The square logo for the brand, resized to 32x32 px. Learn more

brand.favicon_url

The square logo for the brand, resized to 32x32 px. Learn more

brand.logo

The default logo for the brand. Learn more

brand.metafields

The social links for the brand. Learn more

brand.short_description

A short description of the brand. Learn more

{{ brand.short_description }}
"Canada's foremost retailer for potions and potion accessories. Try one of our award-winning artisanal potions, or find the supplies to make your own!"

brand.slogan

The slogan for the brand. Learn more

{{ brand.slogan }}
"Save the toil and trouble!"

brand.square_logo

The square logo for the brand. Learn more

brand_color

The colors defined as part of a store's brand assets. Learn more

brand_color

The colors defined as part of a store's brand assets. To access a brand color, specify the brand color group, the color role, and the 0-based index of the color within the group and role. Learn more

{ shop.brand.colors.primary[0].background }}
{{ shop.brand.colors.primary[0].foreground }}
{{ shop.brand.colors.secondary[0].background }}
{{ shop.brand.colors.secondary[1].background }}
{{ shop.brand.colors.secondary[0].foreground }}
#0b101f
#DDE2F1
#101B2E
#95A7D5
#A3DFFD

canonical_url

The canonical URL for the current page. Learn more

canonical_url

The canonical URL for the current page. Learn more

cart

The cart object can be used and accessed from any file in your theme. Learn more

cart.attributes

cart.attributes allow the capturing of more information on the cart page. This is done by giving an input a name attribute with the following syntax: attributes[attribute-name]. Learn more

{{ cart.attributes.your-pet-name }}
Rex

cart.currency

Returns the currency of the cart. If your store uses multi-currency, then the cart.currency is the same as the customer's local (presentment) currency. Otherwise, the cart currency is the same as your store currency. Learn more

{{ cart.currency.iso_code }}
USD

cart.item_count

Returns the number of items inside the cart. Learn more

{{ cart.item_count }} {{ cart.item_count | pluralize: 'Item', 'Items' }} ({{ cart.total_price | money }})
25 items ($53.00)

cart.items

Returns all of the line items in the cart. Learn more

cart.items_subtotal_price

Returns the sum of the cart's line-item prices after any line-item discount. The subtotal doesn't include taxes (unless taxes are included in the prices), cart discounts, or shipping costs. Learn more

cart.note

cart.note allows the capturing of more information on the cart page. Learn more

cart.original_total_price

Returns the subtotal of the cart before any discounts have been applied. The amount is in the customer's local (presentment) currency. Learn more

cart.total_discount

Returns the total of all discounts (the amount saved) for the cart. The amount is in the customer's local (presentment) currency. Learn more

cart.total_price

Returns the total price of all of the items in the cart. Learn more

cart.total_weight

Returns the total weight, in grams, of all of the items in the cart. Use the weight_with_unit filter to format the weight. Learn more

checkout

The checkout object can be accessed in the order status page of the checkout. Shopify Plus merchants can also access properties of the checkout object in the checkout.liquid layout file. Learn more

checkout.applied_gift_cards

Returns the gift cards applied to the checkout. Learn more

checkout.attributes

Returns the attributes of the checkout that were captured in the cart. Learn more

checkout.billing_address

Returns the billing address of the checkout. Learn more

checkout.buyer_accepts_marketing

Returns whether the buyer accepted the newsletter during the checkout. Learn more

{% if checkout.buyer_accepts_marketing %}
  Thank you for subscribing to our newsletter. You will receive our exclusive newsletter deals!
{% endif %}

checkout.customer

Returns the customer associated with the checkout. Learn more

checkout.discount_applications

Returns an array of discount applications for a checkout. Learn more

{% for discount_application in checkout.discount_applications %}
  Discount name: {{ discount_application.title }}
  Savings: -{{ discount_application.total_allocated_amount | money }}
{% endfor %}
Discount name: SUMMER19
Savings: -$20.00

checkout.discounts

Returns the discounts applied to the checkout. Learn more

{% for discount in checkout.discounts %}
* {{ discount.code }}: {{ discount.amount | money }}
{% endfor %}
* secret-discount: $12.00

checkout.discounts_amount

Returns the sum of the amount of the discounts applied to the checkout. Use one of the money filters to return the value in a monetary format. Learn more

You save: {{ checkout.discounts_amount | money }}
You save: $12.00

checkout.discounts_savings

Returns the sum of the savings of the discounts applied to the checkout. The negative opposite of discounts_amount. Use one of the money filters to return the value in a monetary format. Learn more

checkout.email

Returns the email used during the checkout. Learn more

checkout.gift_cards_amount

Returns the amount paid in gift cards of the checkout. Use one of the money filters to return the value in a monetary format. Learn more

checkout.id

Returns the id of the checkout. Learn more

checkout.line_items

Returns all the line items of the checkout. Learn more

checkout.name

Returns the name of the checkout. This value is identical to checkout.id with a hash prepended to it. Learn more

checkout.note

Returns the note of the checkout. Learn more

checkout.order

Returns the order created by the checkout. Depending on the payment gateway, the order might not have been created yet on the checkout order status page and this property could be nil. Learn more

checkout.order_id

Returns the id of the order created by the checkout. Depending on the payment gateway, the order might not have been created yet on the checkout order status page. Learn more

checkout.order_name

Returns the name of the order created by the checkout. Depending on the payment gateway, the order might not have been created yet on the checkout order status page. Learn more

checkout.order_number

Returns the number of the order created by the checkout. Depending on the payment gateway, the order might not have been created yet on the checkout order status page. Learn more

checkout.requires_shipping

Returns whether the checkout as a whole requires shipping, that is, whether any of the line items require shipping. Learn more

{% if checkout.requires_shipping %}
  You will receive an email with your shipment tracking number as soon as your order is shipped.
{% endif %}

checkout.shipping_address

Returns the shipping address of the checkout. Learn more

checkout.shipping_method

Returns the shipping method of the checkout. Learn more

checkout.shipping_methods

Returns an array of shipping methods of the checkout. Learn more

Shipping methods:
{% for shipping_method in checkout.shipping_methods %}
  * {{ shipping_method.title }}: {{ shipping_method.price | money }}
{% endfor %}
Shipping methods:
* International Shipping: $12.00

checkout.shipping_price

Returns the shipping price of the checkout. Use one of the money filters to return the value in a monetary format. Learn more

checkout.subtotal_price

Returns the subtotal price of the checkout, that is before shipping and before taxes, unless they are included in the prices. Learn more

checkout.tax_lines

Returns all the tax lines of the checkout. Learn more

checkout.tax_price

Returns the tax price of the checkout, whether the taxes are included or not in the prices. Use one of the money filters to return the value in a monetary format. Learn more

checkout.total_price

Returns the total price of the checkout. Use one of the money filters to return the value in a monetary format. Learn more

Total: {{ checkout.total_price | money }}
Total: $26.75

checkout.transactions

Returns an array of transactions from the checkout. Learn more

collection

The collection object. Learn more

collection.all_products_count

Returns the number of products in a collection. collection.all_products_count will return the total number of products even when the collection view is filtered. Learn more

{{ collection.all_products_count }} total products in this collection
24 total products in this collection

collection.all_tags

Returns a list of all product tags in a collection. collection.all_tags will return the full list of tags even when the collection view is filtered. collection.all_tags will return at most 1,000 tags. Learn more

collection.all_types

Returns a list of all product types in a collection. Learn more

{% for product_type in collection.all_types %}
  {{ product_type | link_to_type }}
{% endfor %}
<a href="/collections/types?q=Accessories" title="Accessories">Accessories</a>
<a href="/collections/types?q=Chairs" title="Chairs">Chairs</a>
<a href="/collections/types?q=Shoes" title="Shoes">Shoes</a>

collection.all_vendors

Returns a list of all product vendors in a collection. Learn more

{% for product_vendor in collection.all_vendors %}
  {{ product_vendor | link_to_vendor }}
{% endfor %}
<a href="/collections/vendors?q=Shopify" title="Shopify">Shopify</a>
<a href="/collections/vendors?q=Shirt+Company" title="Shirt Company">Shirt Company</a>
<a href="/collections/vendors?q=Montezuma" title="Montezuma">Montezuma</a>

collection.current_type

Returns the product type on a /collections/types?q=TYPE collection page. For example, you may be on the automatic Shirts collection, which lists all products of type ‘shirts’ in the store: myshop.shopify.com/collections/types?q=Shirts. Learn more

{% if collection.current_type %}
  We are on an automatic product type collection page. The product type is {{ collection.current_type }}.
{% endif %}

collection.current_vendor

Returns the vendor name on a /collections/vendors?q=VENDOR collection page. For example, you may be on the automatic Shopify collection, which lists all products with vendor ‘shopify’ in the store: myshop.shopify.com/collections/vendors?q=Shopify. Learn more

{% if collection.current_vendor %}
  We are on an automatic vendor collection page. The vendor is {{ collection.current_vendor }}.
{% endif %}

collection.default_sort_by

Returns the sort order of the collection, which is set in the collection pages of the Admin. Learn more

collection.description

Returns the description of the collection. Learn more

collection.filters

Returns an array of filter objects that have been set up on the collection. Learn more

collection.handle

Returns the handle of a collection. Learn more

collection.id

Returns the id of a collection. Learn more

collection.image

Returns the collection image. Use the img_url filter to link it to the image file on the Shopify CDN. Check for the presence of the image first. Learn more

{% if collection.image %}
  {{ collection.image | img_url: 'medium' }}
{% endif %}

collection.next_product

Returns the URL of the next product in the collection. Returns nil if there is no next product. This output can be used on the product page to output ‘next’ and ‘previous’ links on the product.liquid template. Learn more

collection.previous_product

Returns the URL of the previous product in the collection. Returns nil if there is no previous product. This output can be used on the product page to output ‘next’ and ‘previous’ links on the product.liquid template. Learn more

collection.products

Returns all of the products inside a collection. Note that there is a limit of 50 products that can be shown per page. Use the pagination tag to control how many products are shown per page. Learn more

collection.products_count

Returns the number of products in a collection. Learn more

{{ collection.all_products_count }} {{ collection.all_products_count | pluralize: 'Item', 'Items' }} total
24 Items

collection.published_at

Returns the date and time when the collection was published. You can set this information on the collection's page in your Shopify admin by the Set publish date calendar icon. You can use a date filter to format the date. Learn more

collection.sort_by

Returns the sort order applied to the collection by the sort_by URL parameter. When there is no sort_by URL parameter, the value is null (e.g. /collections/widgets?sort_by=best-selling). Learn more

{% if collection.sort_by %}
  Sort by: {{ collection.sort_by }}
{% endif %}
Sort by: best-selling

collection.sort_options

Returns an array of sorting options for the collection. Learn more

<select name="sort_by">
{% for option in collection.sort_options %}
  <option value="{{ option.value }}">{{ option.name }}</option>
{% endfor %}
</select>
<select name="sort_by">
  <option value="manual">Featured</option>
  <option value="best-selling">Best selling</option>
  <option value="title-ascending">Alphabetically, A-Z</option>
  <option value="title-descending">Alphabetically, Z-A</option>
  <option value="price-ascending">Price, low to high</option>
  <option value="price-descending">Price, high to low</option>
  <option value="created-ascending">Date, old to new</option>
  <option value="created-descending">Date, new to old</option>
</select>

collection.template_suffix

Returns the name of the custom collection template assigned to the collection, without the collection prefix or the .liquid suffix. Returns nil if a custom template is not assigned to the collection. Learn more

{{ collection.template_suffix }}
no-price

collection.title

Returns the title of the collection. Learn more

<h1>{{ collection.title }}</h1>
Frontpage

collection.tags

Returns all tags of all products in a collection. Learn more

collection.url

Returns the URL of the collection. Learn more

collections

Allows you to access all of the collections on a store. Learn more

collections

You can iterate over collections to build a collection list. Learn more

{% for collection in collections %}
  {{- collection.title | link_to: collection.url }}
{% endfor %}
<a href="/collections/empty" title="">Empty</a>
<a href="/collections/featured-potions" title="">Featured potions</a>
<a href="/collections/freebies" title="">Freebies</a>
<a href="/collections/frontpage" title="">Home page</a>
<a href="/collections/ingredients" title="">Ingredients</a>
<a href="/collections/potions" title="">Potions</a>
<a href="/collections/sale-potions" title="">Sale potions</a>

color

The color object is returned from color type settings, and has the following attributes. Learn more

alpha

Returns the alpha component of the color, which is a decimal number between 0 and 1. Learn more

blue

Returns the blue component of the color, which is a number between 0 and 255. Learn more

green

Returns the green component of the color, which is a number between 0 and 255. Learn more

hue

Returns the hue component of the color, which is a number between 0 and 360. Learn more

lightness

Returns the lightness component of the color, which is a number between 0 and 100. Learn more

red

Returns the red component of the color, which is a number between 0 and 255. Learn more

saturation

Returns the saturation component of the color, which is a number between 0 and 100. Learn more

color_scheme

A color_scheme from a color_scheme setting. Learn more

color_scheme.id

The ID of the color_scheme Learn more

{{ color_scheme.id }}
"background-2"

color_scheme.settings

The setting of the color_scheme Learn more

color_scheme_group

A color_scheme_group from a color_scheme_group setting. Learn more

color_scheme_group

A color_scheme_group from a color_scheme_group setting. Learn more

{% for scheme in settings.color_schemes %}
  .color-{{ scheme.id }} {
    --color-background: {{ scheme.settings.background }};
    --color-text: {{ scheme.settings.text }};
  }
{% endfor %}

comment

The comment object. Learn more

comment.created_at

Returns the timestamp of when the comment was submitted.

Use the date filter to convert the timestamp into a more readable format. Learn more

{{ comment.created_at | date: "%b %d, %Y" }}
Feb 26, 2019

comment.id

Returns the id (unique identifier) of the comment. Learn more

comment.author

Returns the author of the comment. Learn more

comment.email

Returns the email address of the comment’s author. Learn more

comment.content

Returns the content of the comment. Learn more

comment.status

Returns the status of the comment. Learn more

comment.updated_at

Returns the timestamp of when the comment's status was last changed. For example, the timestamp of when a comment was approved by the article's author.

Use the date filter to convert the timestamp into a more readable format. Learn more

{{ comment.updated_at | date: "%b %d, %Y" }}
Mar 13, 2019

comment.url

Returns the URL of the article with comment.id appended to it. This is so the page will automatically scroll to the comment. Learn more

company

A company that a customer is purchasing for. Learn more

company.available_locations

The company locations that the current customer has access to, or can interact with. Learn more

company.id

The ID of the company. Learn more

{{ company.id }}
98369

company.metafields

The metafields applied to the company. Learn more

company.name

The.name of the company. Learn more

{{ company.name }}
"Cornelius' Custom Concoctions"

company_address

The address of a company location. Learn more

company_address.address1

The first line of the address. Learn more

{{ company_address.address1 }}
"99 Cauldron Lane"

company_address.address2

The second line of the address. If no second line is specified, then nil is returned. Learn more

{{ company_address.address2 }}
"Unit 4B"

company_address.attention

The attention line of the address. Learn more

{{ company_address.attention }}
"Cornelius Potionmaker"

company_address.city

The city of the address. Learn more

{{ company_address.city }}
"Edinburgh"

company_address.country

The country of the address. Learn more

{{ company_address.country }}
"Scotland"

company_address.country_code

The country of the address in ISO 3166-1 (alpha 2) format. Learn more

{{ company_address.country_code }}
"GB"

company_address.id

The id of the address. Learn more

{{ company_address.id }}
65

company_address.province

The province of the address. Learn more

{{ company_address.province }}
null

company_address.province_code

The province of the address of the address in ISO 3166-2 (alpha 2) format.. Learn more

{{ company_address.province_code }}
null

company_address.street

A combination of the first and second lines of the address. Learn more

{{ company_address.street }}
"99 Cauldron Lane, Unit 4B

company_address.zip

The zip or postal code of the address. Learn more

{{ company_address.zip }}

company_location

A location of the company that a customer is purchasing for. Learn more

company_location.company

The company that the location is associated with. Learn more

company_location.current?

Returns true if the location is currently selected. Returns false if not. Learn more

{{ company_location.current? }}
false

company_location.id

The ID of the location. Learn more

{{ company_location.id }}
98369

company_location.name

The name of the location. Learn more

{{ company_location.name }}
"99 Cauldron Lane"

company_location.shipping_address

The address of the location. Learn more

{{ company_location.shipping_address }}

company_location.tax_registration_id

The tax ID of the location. Learn more

{{ company_location.tax_registration_id }}
null

company_location.url_to_set_as_current

The URL to set the location as the current location for the customer. Learn more

{{ company_location.url_to_set_as_current }}
"https://polinas-potent-potions.myshopify.com/company_location/update?location_id=98369&return_to=/resource"

content_for_additional_checkout_buttons

Returns checkout buttons for any active payment providers with offsite checkouts. Learn more

content_for_additional_checkout_buttons

Use additional_checkout_buttons to check whether these payment providers exist, and content_for_additional_checkout_buttons to show the associated checkout buttons. Learn more

{% if additional_checkout_buttons %}
  {{ content_for_additional_checkout_buttons }}
{% endif %}

content_for_header

Dynamically returns all scripts required by Shopify. Learn more

content_for_header

Include the content_for_header object in your layout files between the opening and closing head HTML tags. You shouldn't try to modify or parse the content_for_header object because the contents are subject to change, which can change the behavior of your code. Learn more

content_for_index

Dynamically returns the content of sections to be rendered on the home page. Learn more

content_for_index

If you use a Liquid index template (templates/index.liquid), then you must include {{ content_for_index }} in the template. This object can't be used in JSON index templates. Learn more

content_for_layout

Dynamically returns content based on the current template. Learn more

content_for_layout

Include the content_for_layout object in your layout files between the opening and closing body HTML tags. Learn more

country

The country object has the following attributes. Learn more

country.currency

Returns the currency used in the country. Learn more

country.iso_code

Returns the ISO code of the country. For example, US or FR for United States or France. Learn more

country.name

Returns the name of the country. For example, United States or France. Learn more

country.unit_system

Returns the unit system of the country. Can be either imperial or metric. Learn more

country_option_tags

Create option tags for each country. Learn more

country_option_tags

country_option_tags creates an <option> tag for each country. An attribute named data-provinces is set for each country, containing JSON-encoded arrays of the country’s respective subregions. If a country does not have any subregions, an empty array is set for its data-provinces attribute. country_option_tags must be wrapped in <select> HTML tags. Learn more

<select name="country">
  {{ country_option_tags }}
</select>

currency

The currency object contains information about a store's currency. Learn more

currency.name

Returns the name of the currency (for example United States dollars or Euro). Learn more

currency.iso_code

Returns the ISO code of the currency (for example USD or EUR). Learn more

currency.symbol

Returns the currency's symbol (for example, $ or ). Learn more

current_page

The current page number. Learn more

current_page

Returns the current page number. The current_page object has a value of 1 for non-paginated resources. Learn more

{{ page_title }}{% unless current_page == 1 %} - Page {{ current_page }}{% endunless %}
Ingredients - Page 1

current_tags

Product tags are used to filter a collection to only show products that contain a specific product tag. Similarly, article tags are used to filter a blog to only show products that contain a specific article tag. The current_tags variable is an array that contains all tags that are being used to filter a collection or blog. Learn more

Inside collection.liquid

Inside collection.liquid, current_tags contains all product tags that are used to filter a collection. Learn more

Inside blog.liquid

Inside blog.liquid, current_tags contains all article tags that are used to filter the blog. Learn more

customer_address

The customer_address object contains information of addresses tied to a Customer Account. Learn more

customer_address.first_name

Returns the value of the First Name field of the address. Learn more

customer_address.last-name

Returns the value of the Last Name field of the address. Learn more

customer_address.address1

Returns the value of the Address1 field of the address. Learn more

customer_address.address2

Returns the value of the Address2 field of the address. Learn more

customer_address.street

Returns the combined values of the Address1 and Address2 fields of the address. Learn more

customer_address.company

Returns the value of the Company field of the address. Learn more

customer_address.city

Returns the value of the City field of the address. Learn more

customer_address.province

Returns the value of the Province/State field of the address. Learn more

customer_address.province_code

Returns the abbreviated value of the Province/State field of the address. Learn more

customer_address.zip

Returns the value of the Postal/Zip field of the address. Learn more

customer_address.country

Returns the value of the Country field of the address. Learn more

customer_address.country_code

Returns the value of the Country field of the address in ISO 3166-2 standard format. Learn more

{{ customer_address.country_code }}
CA

customer_address.phone

Returns the value of the Phone field of the address. Learn more

customer_address.id

Returns the id of customer address. Learn more

customer

The customer object contains information about a customer who has a Customer Account. The customer can be used and accessed from any file in your theme. Learn more

customer.accepts_marketing

Returns true if the customer accepts marketing. Returns false if the customer does not. Learn more

customer.addresses

Returns an array of all addresses associated with a customer. See customer_address for a full list of available attributes. Learn more

{% for address in customer.addresses %}
  {{ address.street }}
{% endfor %}
126 York St, Suite 200 (Shopify Office)
123 Fake St
53 Featherston Lane

customer.addresses_count

Returns the number of addresses associated with a customer. Learn more

customer.default_address

Returns the default customer_address. Learn more

customer.email

Returns the email address of the customer. Learn more

customer.first_name

Returns the first name of the customer. Learn more

customer.has_account

Returns true if the email associated with an order is also tied to a Customer Account. Returns false if it is not. Helpful in email templates. In the theme, this will always be true. Learn more

customer.id

Returns the id of the customer. Learn more

customer.last_name

Returns the last name of the customer. Learn more

customer.last_order

Returns the last order placed by the customer, not including test orders. Learn more

Your last order was placed on: {{ customer.last_order.created_at | date: "%B %d, %Y %I:%M%p" }}
Your last order was placed on: April 25, 2014 01:49PM

customer.name

Returns the full name of the customer. Learn more

customer.orders

Returns an array of all orders placed by the customer. Learn more

{% for order in customer.orders %}
  {{ order.id }}
{% endfor %}
\#1088
\#1089
\#1090

customer.orders_count

Returns the total number of orders a customer has placed. Learn more

customer.phone

Returns the phone number of the customer. Learn more

customer.tags

Returns the list of tags associated with the customer. Learn more

{% for tag in customer.tags %}
  {{ tag }}
{% endfor %}
wholesale regular-customer VIP

customer.customer-tax_exempt

Returns whether or not the customer is exempt from taxes. Learn more

customer.total_spent

Returns the total amount spent on all orders. Learn more

date

The date object returns a date in ISO 8601 format. Learn more

date

You can use the Liquid date filter to output the date in a more readable format. Learn more

discount

The discount object. Note that this object will display a value only if it’s accessed in notifications or in the Order Printer app. Learn more

discount.id

Returns the id of the discount. Learn more

discount.title

Returns the title or discount code of the discount. Learn more

{{ discount.title }}
SPRING14

discount.code

Returns the title or discount code of the discount. Same as discount.title. Learn more

discount.amount

Returns the amount of the discount. Use one of the money filters to return the value in a monetary format. Learn more

{{ discount.amount | money }}
$25

discount.total_amount

Returns the total amount of the discount if it has been applied to multiple line items. Use a money filter to return the value in a monetary format. Learn more

discount.savings

Returns the amount of the discount’s savings. The negative version of amount. Use one of the money filters to return the value in a monetary format. Learn more

{{ discount.savings | money }}
$-25

discount.total_savings

Returns the total amount of the discount’s savings if it has been applied to multiple line items. The negative version of total_amount. Use a money filter to return the value in a monetary format. Learn more

discount.type

Returns the type of the discount. Learn more

discount allocation

The discount_allocation object contains all of the information about how a particular discount affects a line item and how the price reduces. The object can be accessed on customer order and notification templates. Shopify Plus merchants can also access properties of the discount_allocation object in the checkout.liquid layout file. Learn more

discount_allocation.amount

The discounted amount on a line item by a particular discount. Learn more

discount_allocation.discount_application

The discount application that allocates the amount on the line item. Learn more

discount application

The discount_application object captures the intent of a discount applied on an order. The object can be accessed on customer order and notification templates. Shopify Plus merchants can also access properties of the discount_allocation object in the checkout.liquid layout file. Learn more

discount_application.target_selection

Describes how a discount selects line items in the cart to be discounted. target_selection has the following possible values:

all: The discount applies to all line items.
entitled: The discount applies to a particular subset of line items, often defined by a condition.
explicit: The discount applies to a specifically selected line item or shipping line. Learn more

discount_application.target_type

Describes the type of item that a discount applies to. target_type has the following possible values:

line_item
shipping_line Learn more

discount_application.title

The customer-facing name of the discount. For example, Welcome10 or CBBWQQAKYBYY. Learn more

discount_application.total_allocated_amount

The total amount that the price of an order is reduced by the discount. Learn more

discount_application.type

The type of the discount. type has the following possible values:
automatic
discount_code
manual
script Learn more

discount_application.value

The value of the discount. Learn more

discount_application.value_type

The value type of the discount. value_type has the following possible values:
fixed_amount
percentage Learn more

external_video

The external_video object can be accessed from the product object's media attribute. It contains information about a Vimeo or YouTube video associated with a product. Learn more

external_video.alt

Returns the alt tag of the video set on the product details page of the Shopify admin. Learn more

external_video.aspect_ratio

Returns the aspect ratio of the external video. Learn more

external_video.external_id

Returns the ID of the external video. Learn more

{% assign external_videos = product.media | where: "media_type", "external_video" %}

{% for external_video in external_videos %}
  {{ external_video.external_id }}
{% endfor %}
neFK-pv2sKY
JthaEfEsLYg

external_video.host

Returns the name of the video host (youtube or vimeo). Learn more

external_video.id

Returns the media_id of the external video. Learn more

external_video.media_type

Returns the type of the object (external_video). This can be used to filter the product object's media array. Learn more

{% assign external_videos = product.media | where: "media_type", "external_video" %}

{% for external_video in external_videos %}
  {{external_video.external_id}}
{% endfor %}
neFK-pv2sKY
JthaEfEsLYg

external_video.position

Returns the alt tag of the video set on the product details page of the Shopify admin. Learn more

filter

The filter object represents a storefront filter. Learn more

filter.active_values

Returns an array of filter_value objects that are currently active. Only applies to list type filters. Learn more

filter.inactive_values

Returns an array of filter_value objects that are currently inactive. Only applies to list type filters. Learn more

filter.label

Returns the customer-facing label for the filter. Learn more

filter.max_value

Returns a filter_value object for the maximum value of price_range type filters. Learn more

filter.min_value

Returns a filter_value object for the minimum value of price_range type filters. Learn more

filter.param_name

Returns the name of the filter. For example, filter.v.option.color. Learn more

filter.range_max

Returns the maximum product price within the current collection. This is only valid for filters of type price_range. Learn more

filter.type

Returns the filter type. Can be list or price_range. Learn more

filter.url_to_remove

Returns the current page URL with the filter's currently applied value parameters removed. Learn more

If you want to remove the <code>Color</code> filter, then the <code>url_to_remove</code> attribute returns the following URL:
/collections/all?filter.v.option.size=L

filter.values

Returns an array of filter_value objects for a list type filter. Learn more

filter_value

The filter_value object represents an individual value from a filter object. Learn more

filter_value.active

Returns whether the filter value is active. Returns either true or false. Learn more

filter_value.count

Returns how many results are related to the filter value. Returns a number. Learn more

filter_value.label

Returns the customer facing label for the filter value. For example, Red or Rouge. Learn more

filter_value.param_name

Returns the name of the filter that the filter value belongs to. For example, filter.v.option.color. Filters of type price_range also include an extra component depending on the filter_value source. Learn more

If the filter_value is for a price_range filter's min_value, then the following is returned:
filter.v.price.lte

filter_value.url_to_add

Returns the current page URL with the filter value parameter added. Learn more

filter_value.url_to_remove

Returns the current page URL with the filter value parameter removed. Learn more

filter_value.value

Returns the value. Learn more

focal_point

The focal point for an image. The focal point will remain visible when the image is cropped by the theme. Learn more

focal_point.x

The horizontal position of the focal point, as a percent of the image width. Returns 50 if no focal point is set. Learn more

focal_point.y

The vertical position of the focal point, as a percent of the image height. Returns 50 if no focal point is set. Learn more

font

The font object is used to access the font_picker settings. It can be accessed via the global settings object. Learn more

font.baseline_ratio

Returns the position of the baseline within the em box (measured from the bottom). Learn more

{{ settings.heading_font.baseline_ratio }}
0.091

font.fallback_families

Returns the suggested fallback font families. Learn more

{{ settings.heading_font.fallback_families }}
sans-serif

font.family

Returns the font's name. Learn more

{{ settings.heading_font.family }}
"Neue Haas Unica"

font.style

Returns the selected font style. Learn more

{{ settings.heading_font.style }}
normal

font.system?

Returns true if the font is a system font. You can use this attribute to identify whether you need to embed the corresponding font-face for the font. Learn more

font.weight

Returns the selected font weight. Learn more

{{ settings.heading_font.weight }}
400

font.variants

Returns all of the variants within the font's family. Each of the variants is also a font object. Learn more

{% for variant in settings.heading_font.variants %}
  {{ variant.family }}
{% endfor %}

forloop

The forloop object contains attributes of its parent for loop. Learn more

forloop.first

Returns true if it’s the first iteration of the for loop. Returns false if it is not the first iteration. Learn more

{% for product in collections.frontpage.products %}
  {% if forloop.first == true %}
    First time through!
  {% else %}
    Not the first time.
  {% endif %}
{% endfor %}
First time through!
Not the first time.
Not the first time.
Not the first time.
Not the first time.

forloop.index

Returns the current index of the for loop, starting at 1. Learn more

{% for product in collections.frontpage.products %}
  {{ forloop.index }}
{% else %}
  // no products in your frontpage collection
{% endfor %}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

forloop.index0

Returns the current index of the for loop, starting at 0. Learn more

{% for product in collections.frontpage.products %}
  {{ forloop.index0 }}
{% endfor %}
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

forloop.last

Returns true if it’s the last iteration of the for loop. Returns false if it is not the last iteration. Learn more

{% for product in collections.frontpage.products %}
  {% if forloop.last == true %}
    This is the last iteration!
  {% else %}
    Keep going…
  {% endif %}
{% endfor %}
Keep going…
Keep going…
Keep going…
Keep going…
Keep going…
This is the last iteration!

forloop.rindex

Returns forloop.index in reverse order. Learn more

{% for product in collections.frontpage.products %}
  {{ forloop.rindex }}
{% endfor %}
16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1

forloop.rindex0

Returns forloop.index0 in reverse order. Learn more

{% for product in collections.frontpage.products %}
  {{ forloop.rindex0 }}
{% endfor %}
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

forloop.length

Returns the number of iterations of the for loop. Learn more

<!-- if collections.frontpage.products contains 10 products -->
{% for product in collections.frontpage.products %}
  {% capture length %}{{ forloop.length }}{% endcapture %}
{% endfor %}

{{ length }}
10

form

The form object is used within the form tag. It contains attributes of its parent form. Learn more

form.address1

Returns the first address line associated with the address. Exclusive to form tags with the "address" parameter. Learn more

form.address2

Returns the second address line associated with the address, if it exists. Exclusive to form tags with the "address" parameter. Learn more

form.author

Returns the name of the author of the blog article comment. Exclusive to form tags with the "article" parameter. Learn more

form.body

Returns the content of the blog article comment. Exclusive to form tags with the "article" parameter. Learn more

form.city

Returns the city associated with the address. Exclusive to form tags with the "address" parameter. Learn more

form.company

Returns the company name associated with the address, if it exists. Exclusive to form tags with the "address" parameter. Learn more

form.country

Returns the country associated with the address. Exclusive to form tags with the "address" parameter. Learn more

form.email

Returns the email address of the blog article comment’s author. Exclusive to form tags with the "article" parameter. Learn more

form.country

Returns the country associated with the address. Exclusive to form tags with the "address" parameter. Learn more

form.errors

Returns an array of strings if the form was not submitted successfully. The strings returned depend on which fields of the form were left empty or contained errors. Learn more

{% for error in form.errors %}
  {{ error }}
{% endfor %}
<!-- if the Name field was left empty by the user -->
author

form.first_name

Returns the first name associated with the address. Exclusive to form tags with the "address" parameter. Learn more

form.id

Returns the id (unique identifier) of the form. Learn more

form.last_name

Returns the last name associated with the address. Exclusive to form tags with the "address" parameter. Learn more

form.password_needed

Used only for form tags with the "customer_login" parameter. The form.password_needed attribute always returns true. Learn more

form.phone

Returns the telephone number associated with the address, if it exists. Exclusive to form tags with the "address" parameter. Learn more

form.posted_successfully?

Returns true if the form was submitted successfully, or false if the form contained errors. All forms but the address form set this property. The address form is always submitted successfully. Learn more

{% if form.posted_successfully? %}
  Comment posted successfully!
{% else %}
  {{ form.errors | default_errors }}
{% endif %}

form.province

Returns the province or state associated with the address. Exclusive to form tags with the "address" parameter. Learn more

{{ form.city }}, {{ form.province }}
San Francisco, California

form.set_as_default_checkbox

Renders an HTML checkbox that can submit the current form as the customer's default address. Exclusive to form tags with the "address" parameter. Learn more

{{ form.set_as_default_checkbox }}
<input type="checkbox" id="address_default_address_12345678" name="address[default]" value="1">

form.zip

Returns the zip code or postal code associated with the address. Exclusive to form tags with the "address" parameter. Learn more

form_errors

The error category strings for errors from a form created by a form tag. Learn more

form_errors.messages

The translated error messages for each value in the form_errors array. Learn more

form_errors.translated_fields

The translated names for each value in the form_errors array. Learn more

fulfillment

The fulfillment object. Learn more

fulfillment.tracking_company

Returns the name of the fulfillment service. Learn more

fulfillment.tracking_number

Returns a fulfillment’s tracking number, if it exists. Learn more

Tracking Number: {{ fulfillment.tracking_number }}
Tracking Number: 1Z5F44813600X02768

fulfillment.tracking_url

Returns the URL for a tracking number. Learn more

{{ fulfillment.tracking_url }}
http://wwwapps.ups.com/etracking/tracking.cgi?InquiryNumber1=1Z5F44813600X02768&TypeOfInquiryNumber=T&AcceptUPSLicenseAgreement=yes&submit=Track

fulfillment.fulfillment_line_items

Returns an array of all line items and their quantity included in the fulfillment. Any line items that have already been fulfilled, or are yet to be fulfilled, will not be included in the array. Learn more

We have fulfilled the following items:
<ul>
  {% for line in fulfillment.fulfillment_line_items %}
    <li>{{ line.line_item.title }} × {{ line.quantity }}</li>
  {% endfor %}
</ul>
We have fulfilled the following items:
* T-shirt - White / Medium × 8
* Adorable boots × 1

fulfillment.item_count

Returns the total number of items included in the fulfillment. Learn more

We have fulfilled {{ fulfillment.item_count }} items of your recent order.
We have fulfilled 3 items of your recent order.

generic_file

A file from a file_reference type metafield that is neither an image or video. Learn more

generic_file.alt

The alt text of the media. Learn more

generic_file.id

The ID of the file. Learn more

{{ generic_file.id }}
21918386454593

generic_file.media_type

The media type of the file. Always returns generic_file. Learn more

{{ generic_file.media_type }}
"generic_file"

generic_file.position

The position of the media in the product.media array. If the source is a file_reference metafield, then nil is returned. Learn more

{{ generic_file.position }}
null

generic_file.preview_image

The preview image of the file. Learn more

generic_file.url

The CDN URL text of the file. Learn more

{{ generic_file.url }}
"//polinas-potent-potions.myshopify.com/cdn/shop/files/disclaimer.pdf?v=9043651738044769859"

gift_card

The gift_card object can be accessed in the following templates:
The Gift card created email notification template ‘Email Notifications > Gift card created’
. The gift_card.liquid template. Learn more

gift_card.balance

Returns the amount of money remaining on the gift card. Learn more

gift_card.code

Returns the code that was used to redeem the gift card. Learn more

gift_card.currency

Returns the currency that the card was issued in. Learn more

gift_card.customer

Returns the customer variable of the customer that the gift card is assigned to. Learn more

Hey, {{ gift_card.customer.first_name }}!
Hey, Brian!

gift_card.enabled

Returns true if the card is enabled, or false if the card is disabled. Learn more

gift_card.expired

Returns true if the card is expired, or false if the card is not. Learn more

gift_card.expires_on

Returns the expiration date of the gift card. Learn more

gift_card.initial_value

Returns the initial amount of money on the gift card. Learn more

gift_card.product

Returns the product associated with the purchased gift card, or returns nothing if there is no associated product. Learn more

gift_card.properties

Returns the line item properties assigned to the gift card when it was added to the cart. Learn more

gift_card.url

Returns the unique URL that links to the gift card’s page on the shop (rendered through gift_card.liquid). Learn more

group

The group object contains information about each default rule set in the robots object for the robots.txt file. Learn more

group.rules

Returns of a list of rule objects for each rule in the group. Learn more

group.sitemap

Returns the group's sitemap object. If the group doesn't require a sitemap, then this returns blank.

The sitemap can be accessed at /sitemap.xml.

Learn more

group.user_agent

Returns the group's user_agent object. Learn more

handle

The handle of the resource associated with the current template. Learn more

handle

The handle object will return a value only when an article, blog, collection, page, or product template is being viewed. Learn more

image

The image object returns information about an image. Learn more

image.alt

Returns the alt tag of the image, set in the Products page of the Admin. Learn more

image.aspect_ratio

Returns the aspect ratio (width / height) of the image. Learn more

image.attached_to_variant?

Returns true if the image has been associated with a variant. Returns false otherwise. This can be used in cases where you want to create a gallery of images that are not associated with variants. Learn more

image.height

Returns the height of the image in pixels. Learn more

image.id

Returns the id of the image. Learn more

image.media_type

Returns the type of the object (image). Learn more

image.position

Returns the position of the image, starting at 1. This is the same as outputting forloop.index. Learn more

image.preview_image

Returns a preview image for the image, when accessed through a media object. For example, product.featured_media.preview_image. Learn more

image.product_id

Returns the id of the image's product. Learn more

image.src

Returns the relative path of the product image. This is the same as outputting {{ image }}. Learn more

{% for image in product.images %}
  {{ image.src }}
  {{ image }}
{% endfor %}
products/my_image.jpg
products/my_image.jpg

image.variants

Returns an array of attributes for the variant that the image is associated with. Learn more

{% for image in product.images %}
  {% for variant in image.variants %}
    {{ image.src }} - used for the variant: {{ variant.title }}
  {% endfor %}
{% endfor %}
products/red-shirt.jpeg - used for the variant: Red
products/green-shirt.jpg - used for the variant: Green
products/yellow-shirt.jpg - used for the variant: Yellow

image.width

Returns the width of the image in pixels. Learn more

image_presentation

The presentation settings for an image. Learn more

image_presentation.focal_point

The focal point for the image. Learn more

images

Allows you to access all of the images that have been uploaded to a store. Learn more

images

All of the images that have been uploaded to a store. You can access images from the images array by their filename. Learn more

{{ images['potions-header.png'] | image_url: width: 300 | image_tag }}
<img src="//polinas-potent-potions.myshopify.com/cdn/shop/files/potions-header.png?v=1650325393&amp;width=300" alt="" srcset="//polinas-potent-potions.myshopify.com/cdn/shop/files/potions-header.png?v=1650325393&amp;width=300 300w" width="300" height="173" style="object-position:1.9231% 9.7917%;">

line_item

A line item represents a single line in the shopping cart. There is one line item for each distinct product variant in the cart. Learn more

line_item.discount_allocations

Returns a list of all discount allocations containing the discounted amount and the reference to the parent discount application. line_item.discount_allocations is available on line items in carts, checkouts, orders, and draft orders. Learn more

line_item.final_line_price

Returns the combined price of all the items in the line item. This is equal to line_item.final_price times line_item.quantity. Learn more

line_item.final_price

Returns the price of the line item including all line level discount amounts. Learn more

line_item.fulfillment

Returns the fulfillment of the line item. Learn more

line_item.fulfillment_service

Returns the fulfillment service associated with the line item's variant. Line items that have no fulfillment service will return manual. Learn more

line_item.gift_card

Returns true if the line item's product is a gift card, or false if it is not. Learn more

line_item.grams

Returns the weight of the line item. Use the weight_with_unit filter to format the weight. Learn more

line_item.image

Returns the line item image. Learn more

{{ line_item.image |  img_url: 'small' | img_tag }}
<img src="//cdn.shopify.com/s/files/1/0159/3350/products/hvt401_red_small.jpg?v=1398706734" />

line_item.id

Returns the line item's ID.

The line item ID differs depending on the context:

- cart.items returns the ID of the line item's variant. This ID is not unique, and can be shared by multiple items of the same variant.
- checkout.line_items returns a temporary unique hash generated for the checkout.
- order.line_items returns a unique integer ID.

Learn more

line_item.key

Returns a unique identifier for each item in the cart. Learn more

line_item.line_level_discount_allocations

Returns a list of line-specific discount_allocation objects containing the discounted amount and a reference to the parent discount application. Learn more

line_item.line_level_total_discount

Returns the total amount of all discounts applied to the line item specifically. This doesn't include discounts that are added to the cart. Learn more

line_item.message

Returns the discount message if a script has applied a discount to the line item. This attribute only has a value if you are using the Script Editor app. Learn more

line_item.options_with_values

Returns an array of selected values from the item's product options. Learn more

{% unless line_item.product.has_only_default_variant %}
  <ul>
    {% for option in line_item.options_with_values %}
      <li>{{ option.name }}: {{ option.value }}</li>
    {% endfor %}
  </ul>
{% endunless %}
<ul>
  <li>Size: 42mm</li>
  <li>Color: Silver</li>
  <li>Strap: Stainless Steel</li>
</ul>

line_item.original_line_price

Returns the original price of the line item before discounts were applied. Learn more

line_item.original_price

Returns the original price of the line item before discounts were applied. Learn more

line_item.product

Returns the product of the line item. Learn more

line_item.product_id

Returns the id of the line item’s product. Learn more

line_item.properties

Returns an array of custom information for an item that has been added to the cart. Learn more

{% assign propertySize = line_item.properties | size %}
{% if propertySize > 0 %}
  <ul>
    {% for property in line_item.properties %}
      <li>{{ property.first }}: {{ property.last }}</li>
    {% endfor %}
  </ul>
{% endif %}
Monogram: My dog is the cutest
Gift wrap: Yes

line_item.quantity

Returns the quantity of the line item. Learn more

line_item.requires_shipping

Returns true if the line item requires shipping, or false if it does not. This is set in the variant options in the Products page of the Admin. Learn more

line_item.selling_plan_allocation

Returns a selling_plan_allocation object when the line item contains a selling plan. Learn more

line_item.sku

Returns the SKU of the line item’s variant. Learn more

line_item.successfully_fulfilled_quantity

Returns the successfully fulfilled quantity of the line item. Learn more

line_item.taxable

Returns true if the line item is taxable, or false if it isn’t. This is set in the variant options in the Products page of the Admin. Learn more

line_item.title

Returns the title of this line item. line_item.title combines both the line item’s product.title and the line item’s variant.title, separated by a hyphen. Learn more

{{ line_item.title }}
Balloon Shirt - Medium

line_item.unit_price

Returns the unit price of the line item. The price reflects any discounts that are applied to the line item. Learn more

line_item.unit_price_measurement

Returns a unit_price_measurement object for the line item. Learn more

line_item.url

Returns the URL to the product page using variant deep-linking. Learn more

{{ line_item.title | link_to: line_item.url }}
<a href="/products/t-shirt?variant=12345678">T-Shirt - Small</a>

line_item.url_to_remove

Returns a URL that can be used to remove the line item from the cart. This is only valid within the context of cart line items. Learn more

line_item.variant

Returns the variant of the line item. Learn more

line_item.variant_id

Returns the id of the line item’s variant. Learn more

line_item.vendor

Returns the vendor name of the line item’s product. Learn more

linklists

Allows you to access all of the menus in a store. Learn more

linklists

Allows you to access all of the menus in a store. You can access a specific menu through the linklists object using the menu's handle. Learn more

<!-- Main menu -->
{% for link in linklists.main-menu.links -%}
  {{ link.title | link_to: link.url }}
{%- endfor %}
<!-- Main menu -->
<a href="/" title="">Home</a>
<a href="/collections/all" title="">Catalog</a>
<a href="/pages/contact" title="">Contact</a>

localization

The localization object contains information about the currencies and languages that a store supports. Learn more

localization.available_countries

Returns a list of country objects for each country that the store supports. Learn more

localization.available_languages

Returns a list of shop_locale objects for each language that the currently selected country supports. Learn more

localization.country

Returns the country object for the currently selected country. Learn more

localization.language

Returns the shop_locale object for the currently selected language. Learn more

location

The location object contains location information for individual store locations. Learn more

location.address

Returns the address object corresponding to the location. Learn more

location.id

Returns the ID of the location. Learn more

location.latitude

Returns the latitude associated with the location. Returns nil if the address is not verified. Learn more

location.longitude

Returns the longitude associated to the location. Returns nil if the address is not verified. Learn more

location.name

Returns the name of location. Learn more

measurement

The measurement object contains measurement information for weight, volume, and dimension type metafields. Learn more

measurement.type

Returns the measurement type. Can be dimension, volume, or weight. Learn more

measurement.unit

Returns the name of associated unit for the measurement type. For example, if the type is weight, then the unit might be grams. Learn more

measurement.value

Returns the measurement value. Learn more

media

The media object represents an object returned in a product.media array. The media object is an abstract object that can represent images, models, and videos associated with a product.
You can use media filters to generate URLs and model-viewer tags so that media is rendered on the product page. Learn more

media.alt

Returns the alt tag of the media, set in the Products page of the Admin. Learn more

media.id

Returns the ID of the media. Learn more

media.media_type

Returns the media type of the object. The media_type property can be used to filter the product.media array for all media of a desired type. Learn more

{% assign images = product.media | where: "media_type", "image" %}
{% for image in images %}
  {{ image.alt }}
{% endfor %}
Image of the black stroller

Image of the grey stroller

media.position

Returns the position of the specific media object in the product object's media array. Learn more

media.preview_image

Returns a preview image for the media. Learn more

metafield

Metafields make it possible to store additional information for articles, blogs, collections, customers, orders, pages, products, the shop, and variants. You can access the metafield object through the metafields attribute of these resources. Learn more

metafield.list?

Returns true if the metafield is a list type. Returns false if not. Learn more

metafield.type

Returns the metafield type. Learn more

metafield.value

Returns the metafield value. Learn more

metaobject

A metaobject entry, which includes the values for a set of fields. The set is defined by the parent metaobject_definition. Learn more

metaobject.system

Basic information about the metaobject. These properties are grouped under the system object to avoid collisions between system property names and user-defined metaobject fields. Learn more

metaobject_definition

A metaobject definition defines the structure of a metaobject type for the store, which consists of a merchant-defined set of field definitions. Learn more

metaobject_definition.values

The metaobjects that follow the definition. Learn more

metaobject_definition.values_count

The total number of entries for the metaobject definition. Learn more

metaobject_system

Basic information about a metaobject. These properties are grouped under the system object to avoid collisions between system property names and user-defined metaobject fields. Learn more

metaobject_system.handle

The unique handle of the metaobject. Learn more

metaobject_system.id

The ID of the metaobject. Learn more

metaobject_system.type

The type of the metaobject definition. This is a free-form string that's defined when the metaobject definition is created. Learn more

model

The model object can be accessed from the product object's media attribute. The model object contains information about a 3D model uploaded from the product details page in the Shopify admin. Learn more

model.alt

Returns the alt tag of the model set on the product details page of the Shopify admin. Learn more

model.id

Returns the media.id of the model. Learn more

model.media_type

Returns the type of the object (model). This can be used to filter the product object's media array. Learn more

{% assign models = product.media | where: "media_type", "model" %}
{% for model in models %}
  {{ model.alt }}
{% endfor %}
Model of the black stroller

Model of the grey stroller

model.position

Returns the position of the model in the product object's media array. Learn more

model.preview_image

Returns preview image of the model. Learn more

model.sources

Returns an array of model source objects. Learn more

model_source

The model_source object can be accessed from the model object's sources array. The model_source object contains information about the source files for a model associated with a product. Learn more

model_source.mime_type

Returns the MIME type of the model source file. Learn more

model_source.format

Returns the format of the model source file. Learn more

model_source.url

Returns the URL of the model source file. Learn more

money

A money value, in the the customer's local (presentment) currency. Learn more

money.currency

The customer's local (presentment) currency. Learn more

order

The order object can be accessed in Liquid templates with customer.orders, in order email templates, and in apps such as Order Printer. Learn more

order.attributes

Returns the custom cart attributes for the order, if there are any. You can add as many custom attributes to your cart as you like.

When you're looping through attributes, use {{ attribute | first }} to get the name of the attribute, and {{ attribute | last }} to get its value. Learn more

{% if order.attributes %}
  <p>Order notes:</p>
  <ul>
    {% for attribute in order.attributes %}
      <li><strong>{{ attribute | first }}</strong>: {{ attribute | last }}</li>
    {% endfor %}
  </ul>
{% endif %}
<p>Order notes:</p>
<ul>
  <li><strong>Message to merchant</strong>: I love your products! Thanks!</li>
</ul>

order.billing_address

Returns the billing address of the order. Learn more

order.cancelled

Returns true if an order is canceled, returns false if it is not. Learn more

order.cancelled_at

Returns the timestamp of when an order was canceled. Use the date filter to format the timestamp. Learn more

order.cancel_reason

Returns one of the following cancellation reasons, if an order was canceled:
items unavailable
fraudulent order
customer changed/cancelled order
other Learn more

order.cancel_reason_label

Returns the translated output of an order’s order.cancel_reason Learn more

English: {{ order.cancel_reason }}
French: {{ order.cancel_reason_label }}
English: Items unavailable
French: Produits indisponibles

order.created_at

Returns the timestamp of when an order was created. Use the date filter to format the timestamp. Learn more

order.customer

Returns the customer associated with the order. Learn more

order.customer_url

Returns the URL of the customer’s account page. Learn more

{{ order.name | link_to: order.customer_url }}
<a href="http://johns-apparel.myshopify.com/account/orders/d94ec4a1956f423dc4907167c9ef0413">#1025</a>

order.discount_applications

Returns an array of discount applications for an order. Learn more

{% for discount_application in order.discount_applications %}
  Discount name: {{ discount_application.title }}
  Savings: -{{ discount_application.total_allocated_amount | money }}
{% endfor %}
Discount name: SUMMER19
Savings: -$20.00

order.email

Returns the email address associated with an order. Learn more

order.financial_status

Returns the financial status of an order. The possible values are:
pending
authorized
paid
partially_paid
refunded
partially_refunded
voided Learn more

order.financial_status_label

Returns the translated output of an order’s financial_status. Learn more

English: {{ order.financial_status }}
French: {{ order.financial_status_label }}
English: Paid
French: Payée

order.fulfillment_status

Returns the fulfillment status of an order. Learn more

order.fulfillment_status_label

Returns the translated output of an order’s fulfillment_status. Learn more

English: {{ order.fulfillment_status }}
French: {{ order.fulfillment_status_label }}
English: Unfulfilled
French: Non confirmée

order.line_items

Returns an array of line items from the order. Learn more

order.line_items_subtotal_price

Returns the sum of the order's line-item prices after any line item discounts have been applied. The subtotal amount doesn't include cart discounts, taxes (unless taxes are included in the prices), or shipping costs. Learn more

<!-- subtotal = total dollar value of cart items - line item discount -->
Subtotal: {{ order.line_items_subtotal_price | money }}
<!-- for a cart containing a $500 product with a $50 line item discount -->
Subtotal: $450.00

order.location

POS Only. Returns the physical location of the order. You can configure locations in the Locations settings of the admin. Learn more

order.order_status_url

Returns the link to the order status page for this order. Learn more

order.name

Returns the name of the order in the format set in the Standards & formats section of the General Settings of your Shopify admin. Learn more

{{ order.name }}
\#1025

order.note

Returns the note associated with a customer order. Learn more

Special instructions: {{ order.note }}
Special instructions: Please deliver after 5 PM

order.order_number

Returns the integer representation of the order name. Learn more

{{ order.order_number }}
1025

order.phone

Returns the phone number associated with an order, if it exists. Learn more

order.shipping_address

Returns the shipping address of the order. Learn more

order.shipping_methods

Returns an array of shipping_method variables from the order. Learn more

order.shipping_price

Returns the shipping price of an order. Use a money filter to return the value in a monetary format. Learn more

order.subtotal_line_items

Returns an array of line items that are used to calculate the subtotal_price of an order. Excludes tip line items. Learn more

order.subtotal_price

Returns the subtotal price of an order. Use a money filter to return the value in a monetary format. Learn more

order.tags

Returns an array of all of the order's tags. The tags are returned in alphabetical order. Learn more

{% for tag in order.tags %}
    {{ tag }}
{% endfor %}
new
leather
sale
special

order.tax_lines

Returns an array of tax_line variables for an order. Learn more

{% for tax_line in order.tax_lines %}
  Tax ({{ tax_line.title }} {{ tax_line.rate | times: 100 }}%):
  {{ tax_line.price | money }}
{% endfor %}
Tax (GST 14.0%): $25

order.tax_price

Returns the order’s tax price. Use a money filter to return the value in a monetary format. Learn more

order.total_discounts

Returns the total value of all discounts applied to the order. Learn more

order.total_net_amount

Returns the net amount of the order.

The order.total_net_amount is calculated after refunds are applied. The value is equivalent to order.total_price minus order.total_refunded_amount. Learn more

order.total_price

Returns the total price of an order. Use a money filter to return the value in a monetary format. Learn more

order.total_refunded_amount

Returns the total refunded amount of an order. Learn more

order.transactions

Returns an array of transactions from the order. Learn more

page

The page object. Learn more

page.author

Returns the author of a page. Learn more

page.content

Returns the content of a page. Learn more

page.handle

Returns the handle of a page. Learn more

page.id

Returns the id of a page. Learn more

page.published_at

Returns the timestamp of when the page was created. Use the date filter to format the timestamp. Learn more

page.template_suffix

Returns the name of the custom page template assigned to the page, without the page prefix or the .liquid suffix. Returns nil if a custom template is not assigned to the page. Learn more

<!-- on page.contact.liquid -->
{{ page.template_suffix }}
contact

page.title

Returns the title of a page. Learn more

page.url

Returns the relative URL of a page. Learn more

{{ page.url }}
/pages/about-us

page_description

Returns the meta description of the current page. Learn more

page_description

The meta description of the current page.The page_description object can be used to provide a brief description of a page for search engine listings and social media previews. Learn more

page_image

Returns an image drop for the relevant image to be displayed in social media feeds or search engine listings. Learn more

page_image

Returns an image drop for the relevant image to be displayed in social media feeds or search engine listings.

For product pages, collection pages, and blog posts, the page_image is the resource's featured image if it exists. For example, a product page's page_image is the same as its product.featured_image. If a featured image does not exist, then the page_image is based on the store's social sharing image set in the admin. Learn more

{{ page_image | img_url }}
//cdn.shopify.com/s/files/1/0987/1148/files/nice-candle-and-rocks_300x300.jpg?v=1590502771

page_title

Returns the page title of the current page. The page_title object can be used to specify the title of page for search engine listings and social media previews. Learn more

page_title

Returns the page title of the current page. Learn more

pages

Allows you to access all of the pages on a store. Learn more

pages

Allows you to access all of the pages on a store. You can access a specific page through the pages object using the page's handle. Learn more

{{ pages.contact.title }}
{{ pages['about-us'].title }}
Contact
About us

paginate

The paginate tag’s navigation is built using the attributes of the paginate object. You can also use the default_pagination filter for a quicker alternative. Learn more

paginate.current_page

Returns the number of the current page. Learn more

paginate.current_offset

Returns the total number of items that are on the pages previous to the current one. For example, if you are paginating by 5 items per page and are on the third page, paginate.current_offset would return 10 (5 items × 2 pages). Learn more

paginate.items

Returns the total number of items to be paginated. For example, if you are paginating a collection of 120 products, paginate.items would return 120. Learn more

paginate.parts

Returns an array of all parts of the pagination. A part is a component used to build the navigation for the pagination. Learn more

paginate.next

Returns the part variable for the Next link in the pagination navigation. Learn more

{% if paginate.next.is_link %}
  <a href="{{ paginate.next.url }}">{{ paginate.next.title }}</a>
{% endif %}
<!-- If we're not on the last page, and there still needs to be a Next link -->
<a href="/collections/all?page=17">Next »</a>

paginate.previous

Returns the part variable for the Previous link in the pagination navigation. Learn more

{% if paginate.previous.is_link %}
  <a href="{{ paginate.previous.url }}">{{ paginate.previous.title }}</a>
{% endif %}
<!-- If we're not on the first page, and there still needs to be a Previous link -->
<a href="/collections/all?page=15">« Previous</a>

paginate.page_size

Returns the number of items displayed per page. Learn more

paginate.pages

Returns the number of pages created by the pagination tag. Learn more

part

Each part returned by the paginate.parts array represents a link in the pagination's navigation. Learn more

part.is_link

Returns true if the part is a link, returns false if it is not. Learn more

part.title

Returns the title of the part. Learn more

part.url

Returns the URL of the part. Learn more

pending_payment_instruction_input

Header-value pairs that make up the list of payment information specific to the payment method. This information can be be used by the customer to complete the transaction offline. Learn more

pending_payment_instruction_input.header

The header of the payment instruction. These are payment method-specific. Learn more

pending_payment_instruction_input.value

Contains the corresponding values to the headers of the payment instruction. Learn more

policy

An individual policy of the shop.policies object. An individual policy can also be referenced directly on the shop object. For example shop.privacy_policy. Learn more

policy.body

Returns the content of the policy. Learn more

{% assign policy = shop.privacy_policy %}
{{ policy.body }}
<h2>PRIVACY STATEMENT</h2>
<h3>SECTION 1 - WHAT DO WE DO WITH YOUR INFORMATION?</h3>
<p>When you purchase something from our store...</p>

policy.title

Returns the title of the policy. Learn more

{% for policy in shop.policies %}
  {{ policy.title }}
{% endfor %}
Privacy policy
Refund policy
Shipping policy
Terms of service

policy.url

Returns the URL of the policy. Learn more

{% for policy in shop.policies %}
  {{ policy.url }}
{% endfor %}
/policies/privacy-policy /policies/refund-policy /policies/shipping-policy /policies/terms-of-service

predictive_search_resources

Contains arrays of objects for each resource type that can be returned by a predictive search query. Learn more

predictive_search.articles

The articles associated with the query. Learn more

predictive_search.collections

The collections associated with the search query. Learn more

predictive_search.pages

The pages associated with the query. Learn more

predictive_search.products

The products associated with the query. Learn more