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

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

What is Liquid?

Tools

Reference

The Haravan Cheat Sheet is a resource for building Haravan 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


						{{ 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

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 %}
		

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

{% comment %}

Allows you to leave un-rendered code inside a Liquid template. Any text within the opening and closing comment blocks will not be output, and any Liquid code within will not be executed. Learn more

My name is {% comment %}super{% endcomment %} Haravan.
My name is Haravan.

{% include %}

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

{% form %}

Creates an HTML

element with all the necessary attributes (action, id, etc.) and to submit the form successfully. Learn more

{% 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

{% paginate %}

The paginate tag works in conjunction with the for tag to split content into numerous pages. It must wrap a for tag block that loops through an array. Learn more

{% raw %}

Allows output of Liquid code on a page without being parsed. Learn more

{{ 5 | plus: 6 }} is equal to 11.
{{ 5 | plus: 6 }} is equal to 11.

HTML Filters

HTML filters wrap assets in HTML tags. Learn more

img_tag

Generates an image tag. Learn more

{{ 'smirking_gnome.gif' | asset_url | img_tag }}

script_tag

Generates a script tag. Learn more

{{ 'shop.js' | asset_url | script_tag }}

stylesheet_tag

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

{{ 'shop.css' | asset_url | stylesheet_tag }}

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

{{ "

test

" | escape }}

test

handleize

Formats a string into a handle. Learn more

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

md5

Converts a string into an MD5 hash. Learn more



newline_to_br

Inserts a
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
Two
Three

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 | replace: 'Awesome', 'Mega' }}
Mega Shoes

replace_first

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


{{ 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 }}"

"too many spaces           "

rstrip

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

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

strip_html

Strips all HTML tags from a string. Learn more

{{ "

Hello

World" | strip_html }}
Hello World

strip_newlines

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


{% for tag in collection.tags %}
  {{ tag | link_to_tag: tag }}
{% endfor %}
Mens
Womens
Sale

payment_type_img_url

Returns the URL of the payment type’s SVG image. Used in conjunction with the shop.enabled_payment_types variable. Learn more

{% for type in shop.enabled_payment_types %}

{% endfor %}




product_img_url

Generates the product image URL. Accepts an image size as a parameter. Learn more

{{ product.featured_image | product_img_url: "medium" }}
/cdn.haravan.com/s/files/1/0087/0462/products/shirt14_medium.jpeg_306286452.jpg

haravan_asset_url

Returns the URL of a global assets that are found on Haravan’s servers. Learn more

{{ 'option_selection.js' | haravan_asset_url | script_tag }}

url_for_type

Creates a URL that links to a collection page containing products with a specific product type. Learn more

{{ "T-shirt" | url_for_type }}
collections/types?q=T-shirt

url_for_vendor

Creates a URL that links to a collection page containing products with a specific product vendor. Learn more

{{ "Haravan" | url_for_vendor }}
/collections/vendors?q=Haravan

within

Creates a collection-aware product URL by prepending /collections/collection-handle to a product URL, where collection-handle is the handle of the collection that is currently being viewed. Learn more

{{ product.title }}
Alien Poster

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.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 Haravan CDN. Check for the presence of the image first. Learn more

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

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.title

Returns the title of an article. Learn more

article.url

Returns the relative URL of the article. Learn more

article.user.account_owner

Returns true if the author of the article is the account owner of the shop. Returns false if the author is not the account owner. Learn more

article.user.bio

Returns the bio of the author of an article. This is entered through the Staff members options on the Account page. Learn more

article.user.email

Returns the email of the author of an article. This is entered through the Staff members options on the Account page. Learn more

article.user.first_name

Returns the first name of the author of an article. This is entered through the Staff members options on the Account page. Learn more

article.user.last_name

Returns the last name of the author of an article. This is entered through the Staff members options on the Account page. Learn more

article.user.homepage

Returns the homepage of the author of an article. This is entered through the Staff members options on the Account page. Learn more

checkout

The checkout object can be accessed in the order status page of the checkout. Haravan 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.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

country_option_tags

Create option tags for each country. Learn more

country_option_tags

country_option_tags creates an 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 {{ country_option_tags }}

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

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


{% for product in collections.frontpage.products %}
  {% capture length %}{{ forloop.length }}{% endcapture %}
{% endfor %}
{{ length }}
10

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.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

page_title

Returns the title of a Product, Page, or Blog Article, set in their respective Admin pages. Learn more

page_title

Returns the title of a Product, Page, or Blog Article, set in their respective Admin pages. Learn more

{{ page_title }}
About Us

product

The product object. Learn more

product.available

Returns true if a product is available for purchase. Returns false if all of the products’ variants inventory_quantity values are zero or less, and their inventory_policy is not set to ‘Allow users to purchase this item, even if it is no longer in stock.’ Learn more

product.collections

Returns an array of all of the collections a product belongs to. Learn more

{% for collection in product.collections %}
  {{ collection.title }}
{% endfor %}
Sale
Shirts
Spring

product.compare_at_price_max

Returns the highest compare at price. Use one of the money filters to return the value in a monetary format. Learn more

product.compare_at_price_min

Returns the lowest compare at price. Use one of the money filters to return the value in a monetary format. Learn more

product.compare_at_price_varies

Returns true if the compare_at_price_min is different from the compare_at_price_max. Returns false if they are the same. Learn more

product.content

Returns the description of the product. Alias for product.description. Learn more

product.description

Returns the description of the product. Learn more

product.first_available_variant

Returns the variant object of the first product variant that is available for purchase. In order for a variant to be available, its variant.inventory_quantity must be greater than zero or variant.inventory_policy must be set to continue. A variant with no inventory_policy is considered available. Learn more

product.handle

Returns the handle of a product. Learn more

product.id

Returns the id of the product. Learn more

product.images

Returns an array of the product’s images. Use the product_img_url filter to link to the product image on Haravan’s Content Delivery Network. Learn more

{% for image in product.images %}

{% endfor %}



product.image

The product.image object has the following attributes:
product.image.alt
product.image.attached_to_variant?
product.image.id
product.image.product_id
product.image.position
product.image.src
product.image.variants Learn more

product.options

Returns an array of the product’s options. Learn more

product.price

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

product.price_max

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

product.price_min

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

product.price_varies

Returns true if the product’s variants have varying prices. Returns false if all of the product’s variants have the same price. Learn more

product.selected_variant

Returns the variant object of the currently-selected variant if there is a valid ?variant= parameter in the URL. Returns nil if there is not. Learn more

{{ product.selected_variant.id }}
124746062

product.selected_or_first_available_variant

Returns the variant object of the currently-selected variant if there is a valid ?variant= query parameter in the URL. If there is no selected variant, the first available variant is returned. In order for a variant to be available, its variant.inventory_quantity must be greater than zero or variant.inventory_policy must be set to continue. A variant with no inventory_management is considered available. Learn more

product.tags

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

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

product.template_suffix

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


{{ product.template_suffix }}
wholesale

product.title

Returns the title of the product. Learn more

product.type

Returns the type of the product. Learn more

product.url

Returns the relative URL of the product. Learn more

{{ product.url }}
/products/awesome-shoes

product.variants

Returns an array the product’s variants. Learn more

product.vendor

Returns the vendor of the product. Learn more

shop

The shop object. Learn more

shop.address

You can add attributes to shop.address to return information about a shop’s address. Learn more

shop.collections_count

Returns the number of collections in a shop. Learn more

shop.currency

Returns the shop’s currency in three-letter format (e.g. USD). Learn more

shop.description

Returns the description of the shop. Learn more

shop.domain

Returns the primary domain of the shop. Learn more

shop.email

Returns the shop’s email address. Learn more

shop.enabled_payment_types

Returns an array of accepted credit cards for the shop. Use the payment_type_img_url filter to link to the SVG image file of the credit card. Learn more

shop.metafields

Returns the shop’s metafields. Metafields can only be set using the Haravan API. Learn more

shop.money_format

Returns a string that is used by Haravan to format money without showing the currency. Learn more

shop.money_with_currency_format

Returns a string that is used by Haravan to format money while also displaying the currency. Learn more

shop.name

Returns the shop’s name. Learn more

shop.password_message

Returns the shop’s password page message. Learn more

shop.permanent_domain

Returns the .myharavan.com URL of a shop. Learn more

shop.products_count

Returns the number of products in a shop. Learn more

shop.types

Returns an array of all unique product types in a shop. Learn more

{% for product_type in shop.types %}
  {{ product_type | link_to_type }}
{% endfor %}

shop.url

Returns the full URL of a shop. Learn more

{{ shop.url }}
http://johns-apparel.com

shop.secure_url

Returns the full URL of a shop prepended by the https protocol. Learn more

{{ shop.secure_url }}
https://johns-apparel.com

shop.vendors

Returns an array of all unique vendors in a shop. Learn more

{% for product_vendor in shop.vendors %}
  {{ product_vendor | link_to_vendor }}
{% endfor %}

shop.locale

Returns the locale that the shop is currently displayed in (e.g. en, fr, pt-BR). See the documentation on theme translations for more details on this feature. Learn more

template

template returns the name of the template used to render the current page, with the .liquid extension omitted. Learn more

template

template Learn more


{{ template }}
index

variant

The variant object. Learn more

variant.available

Returns true if the variant is available to be purchased, or false if it is not. In order for a variant to be available, its variant.inventory_quantity must be greater than zero or variant.inventory_policy must be set to continue. A variant with no variant.inventory_management is also considered available. Learn more

variant.barcode

Returns the variant’s barcode. Learn more

variant.compare_at_price

Returns the variant’s compare at price. Use one of the money filters to return the value in a monetary format. Learn more

variant.id

Returns the variant’s unique id. Learn more

variant.image

Returns the image object associated to the variant. Learn more

{{ variant.image.src }}
products/red-shirt.jpeg

variant.inventory_management

Returns the variant’s inventory tracking service. Learn more

variant.inventory_policy

Returns the string continue if the ‘Allow users to purchase this item, even if it is no longer in stock.’ checkbox is checked in the variant options in the Admin. Returns deny if it is unchecked. Learn more

variant.inventory_quantity

Returns the variant’s inventory quantity. Learn more

variant.option1

Returns the value of the variant’s first option. Learn more

variant.option2

Returns the value of the variant’s second option. Learn more

variant.option3

Returns the value of the variant’s third option. Learn more

variant.price

Returns the variant’s price. Use one of the money filters to return the value in a monetary format. Learn more

variant.requires_shipping

Returns a boolean result as to whether the variant is set to require shipping. Learn more

variant.selected

Returns true if the variant is currently selected by the ?variant= URL parameter. Returns false if the variant is not selected by a URL parameter. Learn more

variant.sku

Returns the variant’s SKU. Learn more

variant.taxable

Returns a boolean result as to whether taxes will be charged for this variant. Learn more

variant.title

Returns the concatenation of all the variant’s option values, joined by a /. Learn more


{{ variant.title }}
Red / Small / Wool

variant.url

Returns the variant’s absolute URL. Learn more

{{ variant.url }}
http://my-store.myharavan.com/products/t-shirt?variant=12345678

variant.weight

Returns the variant’s weight in grams. Use the weight_with_unit filter to convert it to the shop’s weight format or the weight unit configured on the variant. Learn more

variant.weight_unit

Returns the unit for the weight configured on the variant. Works well paired with the weight_in_unit attribute and the weight_with_unit filter. Learn more

variant.weight_in_unit

Returns the weight of the product converted to the unit configured on the variant. Works well paired with the weight_unit attribute and the weight_with_unit filter. 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 Learn more

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

Control Flow Tags

Control Flow Tags determine which block of code should be 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 == '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.

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

Math Filters

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

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 | 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 | minus: 15 }}
185

plus

Adds a number to an output. Learn more


{{ 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 | times: 1.15 }}
230

modulo

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

{{ 12 | modulo:5 }}
2

General Filters

General filters serve many different purposes including formatting, converting, and applying CSS classes. Learn more

date

Converts a timestamp into another date format. Learn more

{{ article.published_at | date: "%a, %b %d, %y" }}
Tue, Apr 22, 14

default

Sets a default value for any variable with no assigned value. Can be used with strings, arrays, and hashes. The default value is returned if the variable resolves to nil or an empty string "". A string containing whitespace characters will not resolve to the default value. Learn more

Dear {{ customer.name | default: "customer" }}

Dear customer

Dear customer

Dear

default_errors

Outputs default error messages for the form.errors variable. The messages returned are dependent on the strings returned by form.errors. Learn more

{% if form.errors %}
  {{ form.errors | default_errors }}
{% endif %}

Please enter a valid email address.

default_pagination

Creates a set of links for paginated results. Used in conjunction with the paginate variable. Learn more

{{ paginate | default_pagination }}
1
2
3

17
Next »

highlight

Wraps words inside search results with an HTML tag with the class highlight if it matches the submitted search terms. Learn more

{{ item.content | highlight: search.terms }}

Yellow shirts are the best!

highlight_active

Wraps a tag link in a with the class active if that tag is being used to filter a collection. Learn more


{% for tag in collection.tags %}
    {{ tag | highlight_active | link_to_tag: tag }}
{% endfor %}
Cotton
Crew Neck
Jersey

json

Converts a string into JSON format. Learn more

var content = {{ pages.page-handle.content | json }};
var content = "\u003Cp\u003E\u003Cstrong\u003EYou made it! Congratulations on starting your own e-commerce store!\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EThis is your shop\u0026#8217;s \u003Cstrong\u003Efrontpage\u003C/strong\u003E, and it\u0026#8217;s the first thing your customers will see when they arrive. You\u0026#8217;ll be able to organize and style this page however you like.\u003C/p\u003E\n\u003Cp\u003E\u003Cstrong\u003ETo get started adding products to your shop, head over to the \u003Ca href=\"/admin\"\u003EAdmin Area\u003C/a\u003E.\u003C/strong\u003E\u003C/p\u003E\n\u003Cp\u003EEnjoy the software,  \u003Cbr /\u003E\nYour Haravan Team.\u003C/p\u003E";

weight_with_unit

Formats the product variant’s weight. Learn more

{{ product.variants.first.weight | weight_with_unit }}
24.0 kg

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 %}
  

{{ article.title }}

{% 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

collection

The collection object. 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 %}
Accessories
Chairs
Shoes

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 %}
Haravan
Shirt Company
Montezuma

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.haravan.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 Haravan collection, which lists all products with vendor ‘haravan’ in the store: myshop.haravan.com/collections/vendors?q=Haravan. 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.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 Haravan CDN. Check for the presence of the image first. Learn more

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

collection.image.src

Returns the relative URL to the collection image. Learn more

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

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.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

{{ collection.title }}

Frontpage

collection.tags

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

collection.url

Returns the URL of the collection. Learn more

current_page

Useful for pagination. Learn more

current_page

current_page returns the number of the page you are on when browsing through paginated content. It can be used outside the paginate block. Learn more

{{ page_title }} - Page: {{ current_page }}
Summer Collection - Page: 1

customer

The customer object contains information about a customer who has a Customer Account. 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 (Haravan 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.tags

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

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

customer.total_spent

Returns the total amount spent on all orders. Learn more

form

The form object is used within the form tag. It contains attributes of its parent form. 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.email

Returns the email address of the blog article comment’s author. Exclusive to form tags with the article 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 %}

author

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 %}

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.fulfillment

Returns the fulfillment of the line item. 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.id

Returns the id of the line item, which is the same as the id of its variant. Learn more

line_item.image

Returns the line item image. Learn more

{{ line_item.image |  img_url: 'small' | img_tag }}

line_item.line_price

Returns the combined price of all the items in the line_item. This is the equivalent of line_item.price times line_item.quantity. Learn more

line_item.price

Returns the price of the line item’s variant. 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 %}
  
    {% for property in line_item.properties %}
  • {{ property.first }}: {{ property.last }}
  • {% endfor %}
{% 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.sku

Returns the SKU of the line item’s variant. 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.type

Returns the product type of the line item’s product. 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 }}
T-Shirt - Small

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

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.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 }}
#1025

order.discounts

Returns an array of discounts for an order. Learn more

{% for discount in order.discounts %}
  Code: {{ discount.code }}
  Savings: {{ discount.savings | money }}
{% endfor %}
Code: SUMMER2014
Savings: -€50

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.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 Haravan 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.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_price

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

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_price

Returns the total price of an order. Use a money filter to return the value in a monetary format. 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


{{ 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

tablerow

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

tablerow.length

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

tablerow.index

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

tablerow.index0

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

tablerow.rindex

Returns tablerow.index in reverse order. Learn more

tablerow.rindex0

Returns tablerow.index0 in reverse order. Learn more

tablerow.first

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

tablerow.last

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

tablerow.col

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

tablerow.col0

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

tablerow.col_first

Returns true if the current column is the first column in a row. Returns false if it is not. Learn more

tablerow.col_last

Returns true if the current column is the last column in a row. Returns false if it is not. Learn more

theme

The theme object contains information about published themes in a shop. You can also use themes to iterate through both themes. Learn more

theme.id

Returns the theme’s id. This is useful for when you want to link a user directly to the theme’s Customize theme page. Learn more

theme.role

Returns one of the two possible roles of a theme: main or mobile. Learn more

theme.name

Returns the name of the theme. Learn more

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

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

{% 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

{% tablerow %}

Generates an HTML

. Must be wrapped in an opening
and closing
HTML tags. Learn more


  {% tablerow product in collection.products %}
    {{ product.title }}
  {% endtablerow %}
Cool Shirt Alien Poster Batman Poster Bullseye Shirt Another Classic Vinyl Awesome Jeans

Array Filters

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

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 | first }}
sale

last

Gets the last element in an array. Learn more


{{ product.tags | last }}
awesome

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[2] }}
womens

map

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


{{ collections | map: 'title' }}
SpringSummer

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


{% assign products = collection.products | sort: 'title' %}
{% for product in products %}
   {{ product.title }}
{% endfor %}
A B a b

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 }}

$1.45

$1

money_with_currency

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

{{ 1.45 | money_with_currency }}
 $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


{{ 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

address

The address object contains information entered by a customer in Haravan’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

cart

The cart object. 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 }}

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.note

cart.note allows the capturing of more information on the cart page. 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

comment

The comment object. Learn more

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.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

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

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

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:
    {% for line in fulfillment.fulfillment_line_items %}
  • {{ line.line_item.title }} × {{ line.quantity }}
  • {% endfor %}
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.

page_description

Returns the description of a Product, Page, Collection, or Blog Article, as set in their respective Admin pages. Learn more

page_description

Returns the description of a Product, Page, Collection, or Blog Article, as set in their respective Admin pages. Learn more

{{ page_description }}
This is my About Us page!

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 %}
  {{ paginate.next.title }}
{% endif %}

Next »

paginate.previous

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

{% if paginate.previous.is_link %}
  {{ paginate.previous.title }}
{% endif %}

« Previous

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

shipping_method

The shipping_method object. Learn more

shipping_method.handle

Returns the handle of the shipping method. The price of the shipping rate is appended to the end of the handle. Learn more

{{ shipping_method.handle }}
haravan-international-shipping-25.00

shipping_method.price

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

{{ shipping_method.price | money }}
$15

shipping_method.title

Returns the title of the shipping method. Learn more

{{ shipping_method.title }}
International Shipping

tax_line

The tax_line object. Learn more

tax_line.title

Returns the title of the tax. Learn more

{{ tax_line.title }}
GST

tax_line.price

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

{{ tax_line.price | money }}
€25

tax_line.rate

Returns the rate of the tax in decimal notation. Learn more

{{ tax_line.rate }}
0.14

tax_line.rate_percentage

Returns the rate of the tax in percentage format. Learn more

{{ tax_line.rate_percentage }}%
14%

transaction

The transaction object. Learn more

transaction.id

Returns a unique numeric identifier for the transaction. Learn more

transaction.amount

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

transaction.name

Returns the name of the transaction. Learn more

{{ transaction.name }}
c251556901.1

transaction.status

Returns the status of the transaction. Learn more

transaction.status_label

Returns the translated output of a transaction’s status. Learn more

transaction.created_at

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

transaction.receipt

Returns text with information from the payment gateway about the payment receipt. This includes whether the payment was a test case and an authorization code if one was included in the transaction. Learn more

transaction.kind

Returns the type of transaction. There are five transaction types:

  • authorization is the reserving of money that the customer has agreed to pay.
  • capture is the transfer of the money that was reserved during the authorization stage.
  • sale is a combination of authorization and capture, performed in one step.
  • void is the cancellation of a pending authorization or capture.
  • refund is the partial or full refund of the captured money to the customer.
Learn more

transaction.gateway

Returns the name of the payment gateway used for the transaction. Learn more

{{ transaction.gateway }}
Cash on Delivery (COD)

transaction.payment_details

The payment_details object contains additional properties related to the payment method used in the transaction.
credit_card_company returns the name of the company who issued the customer’s credit card.
credit_card_number returns the customer’s credit card number. All but the last four digits are redacted. Learn more

{{ transaction.payment_details.credit_card_company }}: {{ transaction.payment_details.credit_card_number }}
Visa: •••• •••• •••• 1234