diff --git a/documentation/basics/handle.md b/documentation/basics/handle.md new file mode 100644 index 0000000..8701cbc --- /dev/null +++ b/documentation/basics/handle.md @@ -0,0 +1,101 @@ +--- +layout: default +title: Handles + +nav: + group: Liquid Variables + weight: 2 +--- + +# Handles + + + +{% table_of_contents %} + + +{% anchor_link "What is a handle?", "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, link list) has a handle. + +For example, a page with the title "About Us" can be accessed in Liquid via its handle about-us as shown below: + +{% highlight html %}{% raw %} + +{{ pages.about-us.content }} +{% endraw %}{% endhighlight %} + +{% anchor_link "How are my handles created?", "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. + +{{ '/themes/handle-2.jpg' | image }} + +Whitespaces in a title are replaced by hyphens in the handle. For example, the title "*My Shiny New Title*" will result in a handle called **my-shiny-new-title**. + +{{ '/themes/handle-3.jpg' | image }} + +The handle will also determine the URL of that object. For example, a page with the handle "about-us" would have the url: [http://yourshop.myshopify.com/pages/about-us](http://yourshop.myshopify.com/pages/about-us) + +Shop designs often rely on a static handle for a page, product, or linklist. In order to preserve design elements and avoid broken links, if you modify the title of an object, **Shopify will not automatically update the handle.** + +For example, if you were to change your page title from "About Us" to "About Shopify" ... + +{{ '/themes/handle-4.jpg' | image }} + +... your handle will still be **about-us**. + +{{ '/themes/handle-5.jpg' | image }} + +However, you can change an object's handle manually by changing the value for the "URL & Handle" text box. + +{{ '/themes/handle-6.jpg' | image }} + + + + +{% anchor_link "Accessing attributes via the handle", "attributes-handle" %} + +In many cases you may know the handle of a object whose attributes you want to access. You can access its attributes by pluralizing the name of the object, then using either the square bracket ( [ ] ) or dot ( . ) notation. + +
Input
+Output
+pages as opposed to page.
+
+You can also pass in Theme Settings objects using this notation. This is handy for theme designers who wish to give the users of their themes the ability to select which content to display in their theme.
+
+Input
+Output
++Read more › +
+ + + + + + + + + + +{% anchor_link "Objects", "objects" %} + +Objects contain attributes that are used to display dynamic content on the page. + +{% highlight html %}{% raw %} +{{ product.title }} +{% endraw %}{% endhighlight %} + + ++Read more › +
+ + + + + + + + +{% anchor_link "Filters", "filters" %} + +Filters are used to modify the output of strings, numbers, variables, and objects. + +{% highlight html %}{% raw %} +{{ 'sales' | append: '.jpg' }} +{% endraw %}{% endhighlight %} ++Read more › +
\ No newline at end of file diff --git a/documentation/basics/operators.md b/documentation/basics/operators.md new file mode 100644 index 0000000..14bc9a8 --- /dev/null +++ b/documentation/basics/operators.md @@ -0,0 +1,134 @@ +--- +layout: default +title: Operators + +nav: + group: Liquid Variables + weight: 3 +--- + +# Operators + + + +Liquid has access to all of the logical and comparison operators. These can be used in tags such as if and unless. + + + + +{% table_of_contents %} + + + +{% anchor_link "Basic Operators", "basic-operators" %} + +== |
+ equals | +
!= |
+ does not equal | +
> |
+ greater than | +
< |
+ less than | +
>= |
+ greater than or equal to | + +
<= |
+ less than or equal to | +
or |
+ condition A or condition B | +
and |
+ condition A and condition B | +
contains checks for the presence of a substring inside a string.
+
+
+{% highlight html %}{% raw %}
+{% if product.title contains 'Pack' %}
+ This product's title contains the word Pack.
+{% endif %}
+{% endraw %}{% endhighlight %}
+
+
+contains can also check for the presence of a string in an array of strings.
+
+{% highlight html %}{% raw %}
+{% if product.tags contains 'Hello' %}
+ This product has been tagged with 'Hello'.
+{% endif %}
+{% endraw %}{% endhighlight %}
+
+
+You **cannot** check for the presence of an object in an array of objects using contains. This will not work:
+
+{% highlight html %}{% raw %}
+{% if product.collections contains 'Sale' %}
+ One of the collections this product belongs to is the Sale collection.
+{% endif %}
+{% endraw %}{% endhighlight %}
+
+This will work:
+
+{% highlight html %}{% raw %}
+{% assign in_sale_collection = false %}
+{% for collection in product.collections %}
+ {% if in_sale_collection == false and collection.title == 'Sale' %}
+ {% assign in_sale_collection = true %}
+ {% endif %}
+{% endfor %}
+{% if in_sale_collection %}
+ One of the collections this product belongs to is the Sale collection.
+{% endif %}
+{% endraw %}{% endhighlight %}
+
+
\ No newline at end of file
diff --git a/documentation/basics/true-and-false.md b/documentation/basics/true-and-false.md
new file mode 100644
index 0000000..91763b9
--- /dev/null
+++ b/documentation/basics/true-and-false.md
@@ -0,0 +1,125 @@
+---
+layout: default
+title: Truthy and Falsy
+nav:
+ group: Liquid Variables
+ weight: 6
+---
+
+# Truthy and Falsy in Liquid
+
+
+
+In programming, we describe “truthy” and “falsy” as anything that returns true or false, respectively, when used inside an if statement.
+
+## What is truthy?
+
+All values in Liquid are truthy, with the exception of nil and false.
+
+In the example below, the text “Tobi” is not a boolean, but it is truthy in a conditional:
+
+{% highlight html %}{% raw %}
+{% assign tobi = 'Tobi' %}
+{% if tobi %}
+This will always be true.
+{% endif %}
+{% endraw %}{% endhighlight %}
+
+[Strings](/themes/liquid-documentation/basics/types/#strings), even when empty, are truthy. The example below will result in empty HTML tags if settings.fp_heading is empty:
+
+Input
+{% highlight html %}{% raw %} +{% if settings.fp_heading %} +Output
+{% highlight html %}{% raw %} + +{% endraw %}{% endhighlight %} + +To avoid this, you can check to see if the string isblank, as follows:
+
+settings.page is an empty string or set to a hidden or deleted object, you will end up with an EmptyDrop. The result is an undesirable empty <div>:
+
+Input
+{% highlight html %}{% raw %} +{% if pages[settings.page] %} +Output
+{% highlight html %}{% raw %} + +{% endraw %}{% endhighlight %} + + +## What is falsy? + +The only values that are falsy in Liquid are nil and false. + +[nil](/themes/liquid-documentation/basics/types/#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. Since that is “falsy”, you can do this: + +{% highlight html %}{% raw %} +{% if collection.image %} + +{% endif %} +{% endraw %}{% endhighlight %} + +The value false is returned through many Liquid object properties such as product.available. + +## Summary + +The table below summarizes what is truthy or falsy in Liquid. + +| | truthy | falsy | +| ------------- |:-------------:|:-------------:| +| true | × | | +| false | | × | +| nil | | × | +| string | × | | +| empty string | × | | +| 0 | × | | +| 1 or 2 or 3.14 | × | | +| array | × | | +| empty array | × | | +| collection | × | | +| collection with no products | × | | +| page | × | | +| EmptyDrop | × | | + + + + + + + + + + + + + + + + + + + + + + diff --git a/documentation/basics/types.md b/documentation/basics/types.md new file mode 100644 index 0000000..6a75b38 --- /dev/null +++ b/documentation/basics/types.md @@ -0,0 +1,227 @@ +--- +layout: default +title: Types + +nav: + group: Liquid Variables + weight: 4 +--- + +# 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. + + + + +{% table_of_contents %} + + +{% anchor_link "Strings", "strings" %} + +Strings are declared by wrapping the variable's value in single or double quotes. The to_number filter can be used to convert a string into a number. + +Input
+ +{% highlight html %}{% raw %} +Tracking number: {{ fulfillment.tracking_numbers }} +{% endraw %}{% endhighlight %} + +Output
+ +Input
+Output
+Input
+Output
+split filter to break a single string into an array of substrings. See here for examples.
+
+
+
+
+
+
+
+{% anchor_link "EmptyDrop", "empty-drop" %}
+
+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 [handle](/themes/liquid-documentation/basics/handle). In the example below, page_1, page_2 and page_3 are all EmptyDrop objects.
+
+{% highlight html %}{% raw %}
+{% assign variable = "hello" %}
+{% assign page_1 = pages[variable] %}
+{% assign page_2 = pages["i-do-not-exist-in-your-store"] %}
+{% assign page_3 = pages.this-handle-does-not-belong-to-any-page %}
+{% endraw %}{% endhighlight %}
+
+EmptyDrop objects only have one attribute, empty?, which is always true.
+
+Collections and pages that _do_ exist do not have an empty? attribute. Their empty? is “falsy”, which means that calling it inside an if statement will return false. When using an unless statement on existing collections and pages, empty? will return true.
+
+#### Applications in themes
+
+Using the empty? attribute, you can check to see if a page exists or not _before_ accessing any of its other attributes.
+
+{% highlight html %}{% raw %}
+{% unless pages.frontpage.empty? %}
+
+ We do have a 'frontpage' collection but it's empty.
+ {% endfor %} +{% endunless %} +{% endraw %}{% endhighlight %} + + + + + + + diff --git a/documentation/filters/additional-filters.md b/documentation/filters/additional-filters.md new file mode 100644 index 0000000..d9502c9 --- /dev/null +++ b/documentation/filters/additional-filters.md @@ -0,0 +1,598 @@ +--- +layout: default +title: Additional Filters +nav: + group: Filters + weight: 10 +--- + +# Additional Filters + +General filters serve many different purposes including formatting, converting, and applying CSS classes. + + +{% table_of_contents %} + + + +{% anchor_link "date", "date" %} + +Converts a timestamp into another date format.
+ +Input
+Output
+The date parameters are listed below:
+ +%a |
+ Abbreviated weekday. +
+{% highlight html %}{% raw %}
+{{ article.published_at | date: "%a" }}
+
+{% endraw %}{% endhighlight %}
+
+ |
+
%A |
+ Full weekday name. +
+{% highlight html %}{% raw %}
+{{ article.published_at | date: "%A" }}
+
+{% endraw %}{% endhighlight %}
+
+ |
+
%b |
+ Abbreviated month name. +
+{% highlight html %}{% raw %}
+{{ article.published_at | date: "%b" }}
+
+{% endraw %}{% endhighlight %}
+
+ |
+
%B |
+ Full month name +
+{% highlight html %}{% raw %}
+{{ article.published_at | date: "%B" }}
+
+{% endraw %}{% endhighlight %}
+
+
+
+ |
+
%c |
+ Preferred local date and time representation +
+{% highlight html %}{% raw %}
+{{ article.published_at | date: "%c" }}
+
+{% endraw %}{% endhighlight %}
+
+ |
+
%d |
+ Day of the month, zero-padded (01, 02, 03, etc.). +
+{% highlight html %}{% raw %}
+{{ article.published_at | date: "%d" }}
+
+{% endraw %}{% endhighlight %}
+
+
+ |
+
%-d |
+ Day of the month, not zero-padded (1,2,3, etc.). +
+{% highlight html %}{% raw %}
+{{ article.published_at | date: "%-d" }}
+
+{% endraw %}{% endhighlight %}
+
+
+
+ |
+
%D |
+ Formats the date (dd/mm/yy). +
+{% highlight html %}{% raw %}
+{{ article.published_at | date: "%D" }}
+
+{% endraw %}{% endhighlight %}
+
+
+
+ |
+
%e |
+
+ Day of the month, blank-padded ( 1, 2, 3, etc.). +
+{% highlight html %}{% raw %}
+{{ article.published_at | date: "%e" }}
+
+{% endraw %}{% endhighlight %}
+
+ |
+
%F |
+
+ Returns the date in ISO 8601 format (yyyy-mm-dd). +
+{% highlight html %}{% raw %}
+{{ article.published_at | date: "%F" }}
+
+{% endraw %}{% endhighlight %}
+
+ |
+
%H |
+ Hour of the day, 24-hour clock (00 - 23). +
+{% highlight html %}{% raw %}
+{{ article.published_at | date: "%H" }}
+
+{% endraw %}{% endhighlight %}
+
+
+ |
+
%I |
+ Hour of the day, 12-hour clock (1 - 12). +
+{% highlight html %}{% raw %}
+{{ article.published_at | date: "%I" }}
+
+{% endraw %}{% endhighlight %}
+
+
+ |
+
%j |
+ Day of the year (001 - 366). +
+{% highlight html %}{% raw %}
+{{ article.published_at | date: "%j" }}
+
+{% endraw %}{% endhighlight %}
+
+
+ |
+
+
%k |
+ Hour of the day, 24-hour clock (1 - 24). +
+{% highlight html %}{% raw %}
+{{ article.published_at | date: "%k" }}
+
+{% endraw %}{% endhighlight %}
+
+ |
+
%m |
+ Month of the year (01 - 12). +
+{% highlight html %}{% raw %}
+{{ article.published_at | date: "%m" }}
+
+{% endraw %}{% endhighlight %}
+
+ |
+
%M |
+ Minute of the hour (00 - 59). +
+{% highlight html %}{% raw %}
+{{ article.published_at | date: "%M" }}
+
+{% endraw %}{% endhighlight %}
+
+
+ |
+
%p |
+ Meridian indicator (AM/PM). +
+{% highlight html %}{% raw %}
+{{ article.published_at | date: "%p" }}
+
+{% endraw %}{% endhighlight %}
+
+ |
+
%r |
+ 12-hour time (%I:%M:%S %p) +
+{% highlight html %}{% raw %}
+{{ article.published_at | date: "%r" }}
+
+{% endraw %}{% endhighlight %}
+
+ |
+
%r |
+ 12-hour time (%I:%M:%S %p) +
+{% highlight html %}{% raw %}
+{{ article.published_at | date: "%r" }}
+
+{% endraw %}{% endhighlight %}
+
+ |
+
%R |
+ 24-hour time (%H:%M) +
+{% highlight html %}{% raw %}
+{{ article.published_at | date: "%R" }}
+
+{% endraw %}{% endhighlight %}
+
+ |
+
%T |
+ 24-hour time (%H:%M:%S) +
+{% highlight html %}{% raw %}
+{{ article.published_at | date: "%T" }}
+
+{% endraw %}{% endhighlight %}
+
+ |
+
%U |
+ The number of the week in the current year, starting with the first Sunday as the first day of the first week.
+
+{% highlight html %}{% raw %}
+{{ article.published_at | date: "%U" }}
+
+{% endraw %}{% endhighlight %}
+
+ |
+
%W |
+ The number of the week in the current year, starting with the first Monday as the first day of the first week. +
+{% highlight html %}{% raw %}
+{{ article.published_at | date: "%W" }}
+
+{% endraw %}{% endhighlight %}
+
+ |
+
%w |
+ Day of the week (0 - 6, with Sunday being 0). +
+{% highlight html %}{% raw %}
+{{ article.published_at | date: "%w" }}
+
+{% endraw %}{% endhighlight %}
+
+ |
+
%x |
+ Preferred representation for the date alone, no time. (mm/dd/yy). +
+{% highlight html %}{% raw %}
+{{ article.published_at | date: "%x" }}
+
+{% endraw %}{% endhighlight %}
+
+ |
+
%X |
+ Preferred representation for the time. (hh:mm:ss). +
+{% highlight html %}{% raw %}
+{{ article.published_at | date: "%X" }}
+
+{% endraw %}{% endhighlight %}
+
+ |
+
%y |
+ Year without a century (00.99). +
+{% highlight html %}{% raw %}
+{{ article.published_at | date: "%y" }}
+
+{% endraw %}{% endhighlight %}
+
+ |
+
%Y |
+ Year with a century. +
+{% highlight html %}{% raw %}
+{{ article.published_at | date: "%Y" }}
+
+{% endraw %}{% endhighlight %}
+
+ |
+
%Z |
+ Time zone name. +
+{% highlight html %}{% raw %}
+{{ article.published_at | date: "%Z" }}
+
+{% endraw %}{% endhighlight %}
+
+ |
+
Input
+{% highlight html %}{% raw %} +Dear {{ customer.name | default: "customer" }} +{% endraw %}{% endhighlight %} + +Output
+form.errors.
+
+Input
+Output
+Input
+Output
+ + + + + + + +{% anchor_link "highlight", "highlight" %} + +Wraps words inside search results with an HTML<strong> tag with the class highlight if it matches the submitted search.terms.
+
+Input
+Output
+Wraps a tag link in a <span> with the class active if that tag is being used to filter a collection.
Input
+Output
+ + + + + + + + + +{% anchor_link "json", "json" %} + +Converts a string into JSON format. + +Input
+ +{% highlight html%}{% raw %} +var content = {{ pages.page-handle.content | json }}; +{% endraw %}{% endhighlight %} + +Output
+ +You do not have to wrap the Liquid output in quotations - the json filter will add them in. The json filter will also escape quotes as needed inside the output.
The json filter can also used to make Liquid objects readable by JavaScript:
Formats the product variant's weight. The weight unit is set in General Settings.
+ +Input
+Output
+Joins the elements of an array with the character passed as the parameter. The result is a single string.
+ +Input
+ +Output
+ +Returns the first element of an array.
+ +Input
+ +Output
+ +first can be used in dot notation, in cases where it needs to be used inside a tag.
+
+first on a string returns the first character in the string.
+
+Input
+ +Output
+ +Gets the last element passed in an array.
+ +Input
+ +Output
+ +last can be used in dot notation, in cases where it needs to be used inside a tag.
+
+last on a string returns the last character in the string.
+
+Input
+ +Output
+ +Input
+ +{% highlight html %}{% raw %} + +{% assign collection_titles = collections | map: 'title' %} +{{ collection_titles }} +{% endraw %}{% endhighlight %} + +Output
+Returns the size of a string or an array.
+ +Input
+ +Output
+ +size can be used in dot notation, in cases where it needs to be used inside a tag.
+
+Generates an image tag.
+ +Input
+ +Output
+ +
+{% endraw %}{% endhighlight %}
+img_tag accepts parameters to output an alt tag and class names. The first parameter is output as the alt text, and any other following parameters are output as CSS classes.
+
+Input
+ +Output
+ +
+{% endraw %}{% endhighlight %}
+Generates a script tag.
+ +Input
+ +Output
+Generates a stylesheet tag.
+ +Input
+Output
+{{ }} and are separated with a pipe character |.
+
+Input
+{% highlight html %}{% raw %} + +{{ product.title | upcase }} +{% endraw %}{% endhighlight %} + +Output
+Input
+ +{% highlight html %}{% raw %} +{{ product.title | remove: "Awesome" }} +{% endraw %}{% endhighlight %} + +Output
+{% highlight html %}{% raw %} +Shoes +{% endraw %}{% endhighlight %} + +Multiple filters can be used on one output. They are applied from left to right. + +Input
+{% highlight html %}{% raw %} + +{{ product.title | upcase | remove: "AWESOME" }} +{% endraw %}{% endhighlight %} + +Output
+{% highlight html %}{% raw %} +SHOES +{% endraw %}{% endhighlight %} diff --git a/documentation/filters/math-filters.md b/documentation/filters/math-filters.md new file mode 100644 index 0000000..57de7dc --- /dev/null +++ b/documentation/filters/math-filters.md @@ -0,0 +1,244 @@ +--- +layout: default +title: Math Filters +nav: + group: Filters + weight: '4' +--- + +# Math Filters + +Math filters allow you to apply mathematical tasks. + +Math filters can be linked and, as with any other filters, are applied in order of left to right. In the example below,minus is applied first, then times, and finally divided_by.
+
+Input
+Output
+Divides an output by a number.
+ +Input
+Output
+Input
+Output
+Subtracts a number from an output.
+ +Input
+Output
+ +Adds a number to an output.
+ +Input
+Output
+ +Input
+Output
+Multiplies an output by a number.
+ +Input
+Output
+ +Divides an output by a number and returns the remainder.
+ +Input
+Output
+ +Formats the price based on the shop's HTML without currency setting.
+ +Input
+ +Output
+ +Formats the price based on the shop's HTML with currency setting.
+ +Input
+Output
+ +Formats the price using a decimal.
+ +Input
+ +Output
+ +Appends characters to a string.
+ +Input
+ +Output
+ +Converts a string into CamelCase.
+ +Input
+ +Output
+ +Capitalizes the first word in a string
+ +Input
+ +Output
+ +Converts a string into lowercase.
+ +Input
+ +Escapes a string.
+ +Input
+test
" | escape }} +{% endraw %}{% endhighlight %} +Output
+ +test
+{% endraw %}{% endhighlight %} +Input
+ +Output
+ +An example use case for this filter is showing the Gravatar image associated with the poster of a blog comment:
+ +Input
+{% highlight html %}{% raw %} +Output
+Inserts a <br > linebreak HTML tag in front of each line break in a string.
+ +Input
+Output
+Input
+ +Output
+ +Prepends characters to a string.
+ +Input
+ +Output
+ +Removes all occurrences of a substring from a string.
+ +Input
+ +Output
+ +Removes only the first occurrence of a substring from a string.
+ +Input
+ +Output
+ +Replaces all occurrences of a string with a substring.
+ +Input
+Output
+ +Replaces the first occurrence of a string with a substring.
+ +Input
+Output
+ +split filter takes on a substring as a parameter. The substring is used as a delimiter to divide a string into an array.
+
+
+Input
+Output
+Strips tabs, spaces, and newlines (all whitespace) from the left and right side of a string.
+ +Input
+Output
+Strips tabs, spaces, and newlines (all whitespace) from the left side of a string.
+ +Input
+ +Output
+ +Strips tabs, spaces, and newlines (all whitespace) from the right side of a string.
+ +Input
+ +Output
+ +Strips all HTML tags from a string.
+ +Input
+Output
+Removes any line breaks/newlines from a string.
+ +Converts a string into a number.
+ +Note: when you define a variable using the capture tag, the result is always a string. Theme Settings variables are also strings by default. + +
For example, the following will produce an error, since the num variable is still a string:
By using the to_number filter on the num variable, it can be compared to another number.
+
+
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.
+ +Truncates a string down to 'x' words, where x is the number passed as a parameter. An ellipsis (...) is appended to the truncated string.
+ + +Input
+Output
+Converts a string into uppercase.
+ +Input
+ +Output
+ +Input
+{% highlight html %}{% raw %} +{{ "Output
+Replaces all characters in a string that are not allowed in URLs with their escaped variants, including the ampersand (&).
+ +Input
+{% highlight html %}{% raw %} +{{ "Output
+Input
+Output
+ +Returns the URL of a file in the Files page of the admin.
+ +Input
+Output
+Input
+ +{% highlight html %}{% raw %} +{{ 'Log in' | customer_login_link }} +{% endraw %}{% endhighlight %} + +Output
+ +Input
+Output
+Generates an HTML link. The first parameter is the URL of the link, and the optional second parameter is the title of the link.
+ +Input
+Output
+Input
+Output
+Input
+Output
+Creates a link to all products in a collection that have a given tag.
+ +Input
+Output
+ + + + + + + +{% anchor_link "link_to_add_tag", "link_to_add_tag" %} + +Creates a link to all products in a collection that have a given tag as well as any tags that have been already selected.
+ +Input
+Output
+ + + + + + +{% anchor_link "link_to_remove_tag", "link_to_remove_tag" %} + +Generates a link to all products in a collection that have the given tag and all the previous tags that might have been added already.
+ +Input
+Output
+ + + + + + + +{% anchor_link "payment_type_img_url", "payment_type_img_url" %} + +Returns the URL of the payment type's SVG image. Used in conjunction with the shop.enabled_payment_types variable. + +Input
+{% highlight html %}{% raw %} +{% for type in shop.enabled_payment_types %} +Output
+Generates the product image URL. Accepts an image size as a parameter.
+ +Input
+Output
+
+ pico+ |
+
+ Returns the image at a maximum size of 16 by 16 pixels. + |
+
+ icon+ |
+
+ Returns the image at a maximum size of 32 by 32 pixels. + |
+
+ thumb+ |
+
+ Returns the image at a maximum size of 50 by 50 pixels. + |
+
+ small+ |
+
+ Returns the image at a maximum size of 100 by 100 pixels. + |
+
+ compact+ |
+
+ Returns the image at a maximum size of 160 by 160 pixels. + |
+
+ medium+ |
+
+ Returns the image at a maximum size of 240 by 240 pixels. + |
+
+ large+ |
+
+ Returns the image at a maximum size of 480 by 480 pixels. + |
+
+ grande+ |
+
+ Returns the image at a maximum size of 600 by 600 pixels. + |
+
+ original+ |
+
+ Deprecated - do not use this when creating themes. +Returns the image at a maximum size of 1024 by 1024 pixels. + |
+
+ 1024x1024+ |
+
+ Returns the image at a maximum size of 1024 by 1024 pixels. + |
+
+ 2048x2048+ |
+
+ Returns the image at a maximum size of 2048 by 2048 pixels. + |
+
+ master+ |
+
+ Returns the largest possible image (the current maximum image size is 2048 x 2048 pixels). + |
+
Returns the collection image's URL. Accepts the same size parameters as product_img_url.
+ +Input
+Output
+Input
+Output
+Generates the theme URL.
+ +Generates a URL for a product name by transforming it to a handle. url_for_product does not output the actual handle of the product, which could have been edited to something else.
Input
+Input
+Output
+Input
+Output
+Input
+{% highlight html %}{% raw %} +{{ product.title }} +{% endraw %}{% endhighlight %} + +Output
+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**.
+
+{{ '/themes/address.jpg' | image }}
+
+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.
+
+address can be used in email templates, the Thank You page of the checkout, as well as in apps such as Order Printer.
+
+{% table_of_contents %}
+
+
+
+
+{% anchor_link "address.name", "address-name" %}
+
+Returns the values of the First Name **and** Last Name fields of the address.
+
+Input
+ +{% highlight html %}{% raw %} +Hello, {{ billing_address.name }} +{% endraw %}{% endhighlight %} + +Output
+ +Input
+Output
+Input
+Output
+Input
+Output
+Input
+Output
+Input
+Output
+article object has the following attributes:
+
+
+{% table_of_contents %}
+
+
+
+
+{% anchor_link "article.author", "article-author" %}
+
+ Returns the full name of the article's author.
+ + + + + + + +{% anchor_link "article.comments", "article-comments" %} + +Returns the published comments of an article. Returns an empty array if comments are disabled. + + + + + + +{% anchor_link "article.comments_count", "article-comments_count" %} + +Returns the number of published comments for an article.
+ + + + + + + +{% anchor_link "article.comments_enabled?", "article-comments_enabled?" %} + +Returns true if comments are enabled. Returns false if comments are disabled.
Returns the relative URL where POST requests are sent to when creating new comments.
+ +Input
+Output
+Returns the content of an article.
+ + + + + + + + +{% anchor_link "article.created_at", "article-created_at" %} +Returns the timestamp of when an article was created. Use the date filter to format the timestamp.
+ +Input
+Output
+Returns the excerpt of an article.
+ + + + + + +{% anchor_link "article.excerpt_or_content", "article-excerpt_or_content" %} +Returns article.excerpt of an article if it exists. Returns article.content if an excerpt does not exist for the article.
Returns the id of an article.
+ + + + + +{% anchor_link "article.moderated?", "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.
Returns the date/time when an article was published. Use the date filter to format the timestamp.
+ + + + + + + +{% anchor_link "article.tags", "article-tags" %} +Returns all the tags for an article.
+ +Input
+Output
+Returns the title of an article.
+ + + + + + + +{% anchor_link "article.url", "article-url" %} +Returns the relative URL of the article.
+ +Input
+Output
+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.
+ + + + + + + +{% anchor_link "article.user.bio", "article-user-bio" %} +Returns the bio of the author of an article. This is entered through the Staff members options on the Account page.
+ + + + + + +{% anchor_link "article.user.email", "article-user-email" %} +Returns the email of the author of an article. This is entered through the Staff members options on the Account page.
+ + + + + + + +{% anchor_link "article.user.first_name", "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.
+ + + + +{% anchor_link "article.user.last_name", "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.
+ + + + + + +{% anchor_link "article.user.homepage", "article-user-homepage" %} +Returns the homepage of the author of an article. This is entered through the Staff members options on the Account page.
+ + + + + + + + + diff --git a/documentation/objects/blog.md b/documentation/objects/blog.md new file mode 100644 index 0000000..6b2ed39 --- /dev/null +++ b/documentation/objects/blog.md @@ -0,0 +1,152 @@ +--- +layout: default +title: blog + +nav: + group: Liquid Variables +--- + +# blog + +Theblog object has the following attributes:
+
+{% table_of_contents %}
+
+
+{% anchor_link "blog.all_tags", "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.
+
+Input
+Output
+article.
+
+Input
+Output
+true if comments are enabled, or false if they are disabled.
+
+
+
+
+
+
+
+{% anchor_link "blog.handle", "blog-handle" %}
+Returns the handle of the blog.
+
+
+
+
+
+
+{% anchor_link "blog.id", "blog-id" %}
+Returns the id of the blog.
+
+
+
+
+
+{% anchor_link "blog.moderated?", "blog-moderated?" %}
+Returns true if comments are moderated, or false if they are not moderated.
+
+
+
+
+
+{% anchor_link "blog.next_article", "blog-next_article" %}
+Returns the URL of the next (older) post. Returns "false" if there is no next article.
+
+
+
+
+
+
+
+
+{% anchor_link "blog.previous_article", "blog-previous_article" %}
+
+Returns the URL of the previous (newer) post. Returns false if there is no next article.
+
+
+
+
+
+
+{% anchor_link "blog.tags", "blog-tags" %}
+
+Returns all tags in a blog. Similar to all_tags, but only returns tags of articles that are in the filtered view.
+
+
+
+
+
+
+{% anchor_link "blog.title", "blog-title" %}
+
+Returns the title of the blog.
+
+
+
+
+
+
+
+{% anchor_link "blog.url", "blog-url" %}
+
+Returns the relative URL of the blog.
+
+
+
diff --git a/documentation/objects/cart.md b/documentation/objects/cart.md
new file mode 100644
index 0000000..877c332
--- /dev/null
+++ b/documentation/objects/cart.md
@@ -0,0 +1,147 @@
+---
+layout: default
+title: cart
+
+nav:
+ group: Liquid Variables
+---
+
+# cart
+
+The cart object has the following attributes:
+
+
+{% table_of_contents %}
+
+
+
+{% anchor_link "cart.attributes", "cart-attributes" %}
+
+cart.attributes allow the capturing of more information on the cart page. This is done by giving an input a nameattribute with the following syntax:
+
+cart.attributes can be accessed in order email templates, the Thank You page of the checkout, as well as in apps such as Order Printer.
+
+Input
+ +Output
+ +Returns the number of items inside the cart.
+ +Input
+Output
+Returns all of the line items in the cart.
+ + + + + + +{% anchor_link "cart.note", "cart-note" %} + +cart.note allows the capturing of more information on the cart page.
+
+This is done by submitting the cart form with an HTML textarea and wrapping the cart.note output.
+
+{% raw %}{{ cart.note }}{% endraw %} on the cart page. If there are multiple instances, the one that comes latest in the Document Object Model (DOM) will be submitted with the form.
+{% endblock %}
+
+cart.note can be accessed in order email templates, the Thank You page of the checkout, as well as in apps such as Order Printer. For examples on how to use cart notes, see Ask a customer for additional information.
+
+Input
+Output
+Returns the total price of all of the items in the cart.
+ + + + + + + +{% anchor_link "cart.total_weight", "cart-total_weight" %} + +Returns the total weight of all of the items in the cart.
+ + + + diff --git a/documentation/objects/collection.md b/documentation/objects/collection.md new file mode 100644 index 0000000..02dc77f --- /dev/null +++ b/documentation/objects/collection.md @@ -0,0 +1,455 @@ +--- +layout: default +title: collection + +nav: + group: Liquid Variables +--- + +# collection + +Thecollection object has the following attributes:
+
+
+
+{% table_of_contents %}
+
+
+
+
+
+{% comment %}
+
+Commenting out all_products and all_products_count as I don't see a purpose for them atm. The pagination limit for products and all_products is the same, so what is the difference?
+
+{% anchor_link "collection.all_products", "collection.all_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.
+
+
+
+
+
+
+{% anchor_link "collection.all_products_count", "collection.all_products_count" %}
+
+Returns the number of products in a collection.
+ +Input
+{% highlight html %}{% raw %} +{{ collection.all_products_count }} {{ collection.all_products_count | pluralize: 'Item', 'Items' }} total +{% endraw %}{% endhighlight %} + +Output
+Returns a list of all product types in a collection.
+ +Input
+{% highlight html %}{% raw %} +{% for product_type in collection.all_types %} + {{ product_type | link_to_type }} +{% endfor %} +{% endraw %}{% endhighlight %} + +Output
+ + + + + + + + + + + +{% anchor_link "collection.all_vendors", "collection-all_vendors" %} + +Returns a list of all product vendors in a collection.
+ +Input
+{% highlight html %}{% raw %} +{% for product_vendor in collection.all_vendors %} + {{ product_vendor | link_to_vendor }} +{% endfor %} +{% endraw %}{% endhighlight %} + +Output
+ + + + + + + + + +{% anchor_link "collection.current_type", "collection-current_type" %} + +Returns the product type when filtering a collection by type. For example, you may be on a collection page filtered by a type query parameter via this URL: myshop.shopify.com/collections?types=shirts. + +Input
+Output
+Input
+Output
+Returns the sort order of the collection, which is set in the collection pages of the Admin.
+ +{{ '/themes/collection-sorting.jpg' | image }} + +The possible outputs are: + +- manual +- best-selling +- title-ascending +- title-descending +- price-ascending +- price-descending +- created-ascending +- created-descending + + + + + + + + + + + +{% anchor_link "collection.description", "collection-description" %} + +Returns the description of the collection.
+ + + + + + + +{% anchor_link "collection.handle", "collection-handle" %} + +Returns the handle of a collection.
+ + + + + + + +{% anchor_link "collection.id", "collection-id" %} + +Returns the id of the collection.
+ + + + + + + + +{% anchor_link "collection.image", "collection-image" %} + +Returns the collection image. Use the collection_img_url filter to link it to the image file on the Shopify CDN.
+ +Input
+{% highlight html %}{% raw %} +{{ collection.image | collection_img_url: 'medium' }} +{% endraw %}{% endhighlight %} + +Output
+Returns the collection image's alt tag.
+ + +{% endcomment %} + + + + + + +{% anchor_link "collection.image.src", "collection-image-src" %} + +Returns the relative URL to the collection image.
+ +Input
+{% highlight html %}{% raw %} +{{ collection.image.src | collection_img_url: 'medium' }} +{% endraw %}{% endhighlight %} + +Output
+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. For more information, see How to Navigate within a Collection.
+
+
+
+
+
+
+
+
+
+
+{% anchor_link "collection.previous_product", "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. For more information, see How to Navigate within a Collection.
+
+
+
+
+
+
+
+
+
+{% anchor_link "collection.products", "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.
+
+
+
+
+
+
+
+
+{% anchor_link "collection.products_count", "collection-products_count" %}
+
+Returns the number of products in a collection.
+ +Input
+{% highlight html %}{% raw %} +{{ collection.all_products_count }} {{ collection.all_products_count | pluralize: 'Item', 'Items' }} total +{% endraw %}{% endhighlight %} + +Output
+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.
Input
+{% highlight html %}{% raw %} +{{ collection.template_suffix }} +{% endraw %}{% endhighlight %} + +Output
+Returns the title of the collection.
+ +Input
+{% highlight html %}{% raw %} +Output
+Returns all tags of all products in a collection.
+ + + + + + + + +{% anchor_link "collection.url", "collection-url" %} + +Returns the URL of the collection.
+ + + + + + + diff --git a/documentation/objects/comment.md b/documentation/objects/comment.md new file mode 100644 index 0000000..552d06f --- /dev/null +++ b/documentation/objects/comment.md @@ -0,0 +1,71 @@ +--- +layout: default +title: comment + +nav: + group: Liquid Variables +--- + +# comment + +Thecomment object has the following attributes:
+
+
+{% table_of_contents %}
+
+
+{% anchor_link "comment.id", "comment-id" %}
+
+Returns the id (unique identifier) of the comment.
+
+
+
+
+
+{% anchor_link "comment.author", "comment-author" %}
+
+Returns the author of the comment.
+
+
+
+
+
+
+{% anchor_link "comment.email", "comment-email" %}
+
+Returns the e-mail address of the comment's author.
+
+
+
+
+
+{% anchor_link "comment.content", "comment-content" %}
+
+Returns the content of the comment.
+
+
+
+
+
+
+{% anchor_link "comment.status", "comment-status" %}
+
+Returns the status of the comment. The possible values are:
+
+- unapproved
+- published
+- removed
+- spam
+
+
+
+
+
+
+{% anchor_link "comment.url", "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.
+
+
+
+
diff --git a/documentation/objects/country-option-tags.md b/documentation/objects/country-option-tags.md
new file mode 100644
index 0000000..37a664c
--- /dev/null
+++ b/documentation/objects/country-option-tags.md
@@ -0,0 +1,37 @@
+---
+layout: default
+title: country_option_tags
+
+nav:
+ group: Liquid Variables
+---
+
+# 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.
+
+
+Input
+ +{% highlight html %}{% raw %} + +{% endraw %}{% endhighlight %} + +Output
+ +{% highlight html %} + +{% endhighlight %} + diff --git a/documentation/objects/current-page.md b/documentation/objects/current-page.md new file mode 100644 index 0000000..b201e93 --- /dev/null +++ b/documentation/objects/current-page.md @@ -0,0 +1,26 @@ +--- +layout: default +title: current_page + +nav: + group: Liquid Variables +--- + +# 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.
+
+Input
+ +{% highlight html %}{% raw %} +{{ page_title }} - Page: {{ current_page }} +{% endraw %}{% endhighlight %} + +Output
+ +current_tags variable is an array that contains all tags that are being used to filter a collection or blog.
+
+{% block "note-information" %}
+Tags inside the current_tags array will always display in alphabetical order. It is not possible to manually change the order.
+{% endblock %}
+
+
+{% table_of_contents %}
+
+
+
+{% anchor_link "Inside collection.liquid", "collection" %}
+
+Inside collection.liquid, current_tags contains all product tags that are used to filter a collection.
+
+The example below creates a list that displays every tag within every product in a collection. If the collection is filtered by the tag (i.e. if current_tags **does** contain the tag), the link will remove the filter. If the collection is not currently filtered by the tag (if current_tags **does not** contain the tag), a link will appear to allow the user to do so.
+
+{% highlight html %}{% raw %}
+current_tags contains all article tags that are used to filter the blog.
+
+The example below adds a breadcrumb that shows which article tag is being used to filter a blog. If there is a tag being used to filter a blog, the breadcrumb displays the tag name and provides a link back to the unfiltered blog.
+
+{% highlight html %}{% raw %}
+{% if current_tags %}
+ customer_address contains information of addresses tied to a Customer Account.
+
+{% table_of_contents %}
+
+
+
+
+
+{% anchor_link "customer_address.first_name", "first-name" %}
+
+Returns the value of the First Name field of the address.
+
+
+
+
+
+
+
+
+{% anchor_link "customer_address.last_name", "last-name" %}
+
+Returns the value of the Last Name field of the address.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{% anchor_link "customer_address.address1", "customer_address-address1" %}
+
+Returns the value of the Address1 field of the address.
+
+
+
+
+
+
+
+
+{% anchor_link "customer_address.address2", "customer_address-address2" %}
+
+Returns the value of the Address2 field of the address.
+
+
+
+
+
+
+
+
+
+
+{% anchor_link "customer_address.street", "street" %}
+
+Returns the combined values of the Address1 and Address2 fields of the address.
+
+Input
+Output
+Input
+Output
+Input
+Output
+Input
+Output
+Input
+Output
+The customer object contains information of customers who have created a Customer Account.
customer can also be accessed in order email templates, the Thank You page of the checkout, as well as in apps such as Order Printer.
Returns true if the customer accepts marketing, returns false if the customer does not.
Input
+Output
+Returns the number of addresses associated with a customer.
+ + + + + + + + +{% anchor_link "customer.default_address", "customer-default_address" %} + +Returns the default customer_address of a customer.
+ + + + + + + + +{% anchor_link "customer.email", "customer-email" %} + +Returns the email address of the customer.
+ + + + + + + + + +{% anchor_link "customer.first_name", "customer-first_name" %} + +Returns the first name of the customer.
+ + + + + + + + +{% anchor_link "customer.id", "customer-id" %} + +Returns the id of the customer.
+ + + + + + + + + + +{% anchor_link "customer.last_name", "customer-last_name" %} + +Returns the last name of the customer.
+ + + + + + + + + + +{% anchor_link "customer.last_order", "customer-last_order" %} + +Returns the last order placed by the customer.
+ +Input
+Output
+Returns the full name of the customer.
+ + + + + + + + + +{% anchor_link "customer.orders", "customer-orders" %} + +Returns an array of all orders placed by the customer.
+ +Input
+Output
+Returns the total number of orders a customer has placed.
+ + + + + + + + +{% anchor_link "customer.recent_order", "customer-recent_order" %} + +Returns the most recent order placed by the customer.
+ +Input
+Output
+Input
+Output
+Returns the total amount spent on all orders.
+ + + + diff --git a/documentation/objects/discount.md b/documentation/objects/discount.md new file mode 100644 index 0000000..fc9a704 --- /dev/null +++ b/documentation/objects/discount.md @@ -0,0 +1,111 @@ +--- +layout: default +title: discount + +nav: + group: Liquid Variables +--- + +# discount + +Thediscount object has the following attributes:
+
+
+{% table_of_contents %}
+
+
+{% anchor_link "discount.id", "discount.id" %}
+
+Returns the id of the discount.
+
+
+
+
+
+
+
+{% anchor_link "discount.code", "discount-code" %}
+
+Returns the code of the discount.
+
+Input
+Output
+Input
+Output
+Input
+Output
+discount.type are:
+
+- FixedAmountDiscount
+- PercentageDiscount
+- ShippingDiscount
+
+
diff --git a/documentation/objects/for-loops.md b/documentation/objects/for-loops.md
new file mode 100644
index 0000000..cb9c4be
--- /dev/null
+++ b/documentation/objects/for-loops.md
@@ -0,0 +1,252 @@
+---
+layout: default
+title: forloop
+
+nav:
+ group: Liquid Variables
+---
+
+# forloop
+
+The forloop object contains attributes of its parent for loop.
+
+
+{% block "note-information" %}
+The forloop object can only be used within for tags.
+{% endblock %}
+
+
+
+
+
+{% table_of_contents %}
+
+
+
+
+
+{% anchor_link "forloop.first", "first" %}
+
+Returns true if it's the first iteration of the for loop. Returns false if it is not the first iteration.
+
+Input
+ +Output
+Input
+Output
+Input
+Output
+true if it's the last iteration of the for loop. Returns false if it is not the last iteration.
+
+
+Input
+ +Output
+Input
+Output
+Input
+Output
+Returns the number of iterations of the for loop.
+ +Input
+Output
+form object is used within the form tag. It contains attributes of its parent form.
+
+
+
+
+{% table_of_contents %}
+
+
+
+
+
+{% anchor_link "form.author", "form-author" %}
+
+ Returns the name of the author of the blog article comment. Exclusive to form tags with the "article" parameter.
Returns the content of the blog article comment. Exclusive to form tags with the "article" parameter.
Returns the email of the blog article comment's author. Exclusive to form tags with the "article" parameter.
Input
+Output
+form.errors to output default error messages without having to loop through the array.
+
+Input
+Output
+Returns true if a comment by the user was submitted successfully, or false if the form contained errors.
fulfillment object has the following attributes:
+
+
+{% table_of_contents %}
+
+
+
+{% comment %} Commenting out as this doesn't actually work.
+
+{% anchor_link "fulfillment.created_at", "fulfillment.created_at" %}
+
+Returns the date the fulfillment was created at.
+ +Returns the name of the fulfillment service.
+ + + + + + + + +{% anchor_link "fulfillment.tracking_number", "fulfillment-tracking_number" %} + +Returns the tracking number for a fulfillment if it exists.
+ +Input
+Output
+Returns the URL for a tracking number.
+ +Input
+Output
+gift_card object can be accessed in the following templates:
+
+1. The Gift Card Notification email notification template [Email Notifications > Gift Card Notification](http://shopify.com/admin/settings/notifications)
+
+2. The [**gift_card.liquid**](/themes/theme-development/templates/gift-cards-liquid/) template.
+
+The gift_card variable has the following attributes:
+
+
+{% table_of_contents %}
+
+
+
+
+{% anchor_link "gift_card.balance", "gift_card-balance" %}
+
+Returns the amount of money remaining on the gift card.
+ + + + + + + + + + +{% anchor_link "gift_card.code", "gift_card-code" %} + +Returns the code that was used to redeem the gift card.
+ + + + + + + + + + +{% anchor_link "gift_card.currency", "gift_card-currency" %} + +Returns the currency that the card was issued in.
+ + + + + + + + + +{% anchor_link "gift_card.customer", "gift_card-customer" %} + +Returns the customer variable of the customer that the gift card is assigned to. + +Input
+Output
+Returns true if the card is enabled, or false if the card is disabled.
Returns true if the card is expired, or false if the card is not.
Returns the expiration date of the gift card
+ + + + + + + + + + +{% anchor_link "gift_card.initial_value", "gift_card-initial_value" %} + +Returns the initial amount of money on the gift card.
+ + + + + + + + + +{% anchor_link "gift_card.properties", "gift_card-properties" %} + +Returns the line item properties assigned to the gift card when it was added to the cart.
+ + + + + + + + +{% anchor_link "gift_card.url", "gift_card-url" %} + +Returns the unique URL that links to the gift card's page on the shop (rendered through gift_card.liquid).
+ + + + diff --git a/documentation/objects/image.md b/documentation/objects/image.md new file mode 100644 index 0000000..b2d74be --- /dev/null +++ b/documentation/objects/image.md @@ -0,0 +1,112 @@ +--- +layout: default +title: image + +nav: + group: Liquid Variables +--- + +# image + +Theimage object has the following attributes:
+
+
+{% table_of_contents %}
+
+
+
+
+{% anchor_link "image.alt", "image-alt" %}
+
+Returns the alt tag of the image, set in the Products page of the Admin.
+ + + + + + + + + +{% anchor_link "image.id", "image-id" %} + +Returns the id of the image. + + + + + + + + +{% anchor_link "image.product_id", "image-product_id" %} + +Returns the id of the image's product. + + + + + + + +{% anchor_link "image.position", "image-position" %} + +Returns the position of the image, starting at 1. This is the same as outputting forloop.index. + + + + + + + + +{% anchor_link "image.src", "image-src" %} + +Returns the relative path of the product image. This is the same as outputting{{ image }}.
+
+Input
+Output
+product_img_url filter.
+
+Input
+Output
+product object contains an attribute called title that can be used to output the title of a product.
+
+**Liquid objects** are also often refered to as **Liquid variables**.
+
+To output an object's attribute on the page, wrap them in {{ and }}, as shown below:
+
+{% highlight html %}{% raw %}
+{{ product.title }}
+{% endraw %}{% endhighlight %}
+
+
+blogs |
+
+
+{% highlight html %}{% raw %}
+
+
The liquid object |
+
cart |
+
+
+ The liquid object |
+
collections |
+
+
+{% highlight html %}{% raw %}
+{% for product in collections.frontpage.products %}
+ {{ product.title }}
+{% endfor %}
+{% endraw %}{% endhighlight %}
+
+ The liquid object |
+
current_page |
+
+
+{% highlight html %}{% raw %}
+{% if current_page != 1 %} Page {{ current_page }}{% endif %}
+{% endraw %}{% endhighlight %}
+
+ The |
+
current_tags |
+
+
+{% highlight html %}{% raw %}
+
+{% if current_tags %}
+
+ {{ blog.title | link_to: blog.url }} › {{ current_tags.first }}+{% else %} +{{ blog.title }}+{% endif %} +{% endraw %}{% endhighlight %} +The |
+
customer |
+
+
+{% highlight html %}{% raw %}
+{% if shop.customer_accounts_enabled %}
+ {% if customer %}
+ My Account
+ {{ 'Log out' | customer_logout_link }}
+ {% else %}
+ {{ 'Log in' | customer_login_link }}
+ {% if shop.customer_accounts_optional %}
+ {{ 'Create an account' | customer_register_link }}
+ {% endif %}
+ {% endif %}
+{% endif %}
+{% endraw %}{% endhighlight %}
+
+ The liquid object |
+
linklists |
+
+
+{% highlight html %}{% raw %}
+
+
The liquid object |
+
pages |
+
+
+{% highlight html %}{% raw %}
+
+ {{ pages.about.title }}+{{ pages.about.author }} says... +{{ pages.about.content }}
+{% endraw %}{% endhighlight %}
+ The liquid object |
+
page_description |
+
+
+{% highlight html %}{% raw %}
+{% if page_description %}
+
+{% endif %}
+{% endraw %}{% endhighlight %}
+
+ Merchants can specify a |
+
page_title |
+
+
+{% highlight html %}{% raw %}
+{{ page_title }}
+{% endraw %}{% endhighlight %}
+
+ The liquid object |
+
shop |
+
+
+
+ The liquid object |
+
template |
+
+
+{% highlight html %}{% raw %}
+{% if template contains 'product' %}
+ WE ARE ON A PRODUCT PAGE.
+{% endif %}
+{% endraw %}{% endhighlight %}
+
+ The liquid object |
+
settings |
+
+
+{% highlight html %}{% raw %}
+{% if settings.use_logo %}
+{{ 'logo.png' | asset_url | img_tag: shop.name }}
+{% else %}
+{{ shop.name }}
+{% endif %}
+{% if settings.featured_collection and settings.featured_collection != '' and collections[settings.featured_collection].handle == settings.featured_collection and collections[settings.featured_collection].products_count > 0 %}
+{% for product in collections[settings.featured_collection].products %}
+ {% include 'product-loop' %}
+{% endfor %}
+{% endif %}
+{% endraw %}{% endhighlight %}
+
+ The liquid object |
+
theme |
+
+
+{% highlight html %}{% raw %}
+Go to your theme settings.
+{% endraw %}{% endhighlight %}
+
+ The liquid object |
+
themes |
+
+
+{% highlight html %}{% raw %}
+We have a beautiful mobile theme, it's called {{ themes.mobile.name | link_to_theme: "mobile" }}
+{% endraw %}{% endhighlight %}
+
+ The liquid object |
+
line_item object can be accessed in all Liquid templates, as well as in notification email templates, the Thank You page of the checkout, as well as in apps such as [Order Printer](http://docs.shopify.com/manual/more/official-shopify-apps/order-printer).
+
+The line_item object has the following attributes:
+
+
+{% table_of_contents %}
+
+
+
+
+
+{% anchor_link "line_item.id", "line-id" %}
+
+Returns the id of the line item, which is the same as the id of its [variant](/themes/liquid-documentation/objects/variant/).
+
+
+
+
+
+
+
+
+{% anchor_link "line_item.product", "product" %}
+
+Returns the [product](/themes/liquid-documentation/objects/product/) of the line item.
+
+Example for getting a line item's image:
+
+{% highlight html %}{% raw %}
+{{ line_item.product.featured_image | product_img_url | img_tag }}
+{% endraw %}{% endhighlight %}
+
+
+
+
+
+
+
+
+{% anchor_link "line_item.variant", "variant" %}
+
+Returns the [variant](/themes/liquid-documentation/objects/variant/) of the line item.
+
+
+
+
+
+
+
+
+
+
+
+
+{% anchor_link "line_item.title", "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.
+
+Input
+Output
+title of the respective variables.
+
+Input
+Output
+line_item.price times line_item.quantity.
+
+
+
+
+
+
+
+
+
+{% anchor_link "line_item.quantity", "quantity" %}
+
+Returns the quantity of the line item.
+
+
+
+
+
+
+
+
+{% anchor_link "line_item.grams", "grams" %}
+
+Returns the weight of the line item. Use the [weight_with_unit](/themes/liquid-documentation/filters/additional-filters/#weight_with_unit) filter to format the weight.
+
+
+
+
+
+
+
+
+
+{% anchor_link "line_item.sku", "sku" %}
+
+Returns the SKU of the line item's variant.
+
+
+
+
+
+
+
+
+{% anchor_link "line_item.vendor", "vendor" %}
+
+Returns the vendor name of the line item's product.
+
+
+
+
+
+
+
+
+
+
+
+{% anchor_link "line_item.requires_shipping", "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.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{% anchor_link "line_item.variant_id", "variant-id" %}
+
+Returns the id of the line item's variant.
+
+
+
+
+
+
+
+
+
+
+
+{% anchor_link "line_item.product_id", "product-id" %}
+
+Returns the id of the line item's product.
+
+
+
+
+
+
+
+
+
+{% anchor_link "line_item.fulfillment", "fulfillment" %}
+
+Returns the [fulfillment](/themes/liquid-documentation/objects/fulfillment/) of the line item.
+
+
+
+
diff --git a/documentation/objects/link.md b/documentation/objects/link.md
new file mode 100644
index 0000000..8d73f53
--- /dev/null
+++ b/documentation/objects/link.md
@@ -0,0 +1,107 @@
+---
+layout: default
+title: link
+
+nav:
+ group: Liquid Variables
+---
+
+# link
+
+The link object cannot be invoked on its own. It must be invoked inside a linklist.
+
+The link object has the following attributes:
+
+
+
+{% table_of_contents %}
+
+{% anchor_link "link.active", "link-active" %}
+
+Returns true if the link is active, or false if the link is inactive.
If you are on a product page that is collection-aware, link.activewill return true for both the collection-aware product URL and the collection-agnostic URL. For example, if you have a link whose URL points to:
link.active will return true for the following URL, which links to the same product but through a collection:
+
+
If you are on a collection page filtered with tags, and the link points to the unfiltered collection page, link.active will return true.
If you are on an article page and your link points to the blog, link.active will return true.
link.object, you can access any of the attributes that are available in the above three variables.
+
+Input
+Output
+Returns the title of the link.
+ + + + + +{% anchor_link "link.type", "link-type" %} + +Returns the type of the link. The possible values are: + +- collection_link: if the link points to a collection +- product_link: if the link points to a product page +- page_link: if the link points to a page +- blog_link: if the link points to a blog +- relative_link: if the link points to the search page, the home page or /collections/all +- http_link: if the link points to an external web page, or a type or vendor collection (ex: /collections/types?q=Pants) + + + + + + +{% anchor_link "link.url", "link-url" %} + +Returns the URL of the link.
+ + diff --git a/documentation/objects/linklist.md b/documentation/objects/linklist.md new file mode 100644 index 0000000..7836e4b --- /dev/null +++ b/documentation/objects/linklist.md @@ -0,0 +1,80 @@ +--- +layout: default +title: linklist + +nav: + group: Liquid Variables +--- + +# linklist + + +Thelinklist object has the following attributes:
+
+
+
+{% table_of_contents %}
+
+
+
+
+
+{% anchor_link "linklist.handle", "linklist-handle" %}
+
+Returns the handle of the linklist.
+ + + + + + + +{% anchor_link "linklist.id", "linklist-id" %} + +Returns the id of the linklist.
+ + + + + + + + +{% anchor_link "linklist.links", "linklist-links" %} + +Returns an array of links in the linklist.
+ +Input
+Output
+ + + + + + + + + + + + +{% anchor_link "linklist.title", "linklist-title" %} + +Returns the title of the linklist.
+ + diff --git a/documentation/objects/metafield.md b/documentation/objects/metafield.md new file mode 100644 index 0000000..e843a49 --- /dev/null +++ b/documentation/objects/metafield.md @@ -0,0 +1,100 @@ +--- +layout: default +title: metafield +nav: + group: Liquid Variables +--- + +# metafields + +Themetafields object allows you to store additional information for products, collections, orders, blogs, pages and your shop. You can output metafields on your storefront using Liquid.
+
+There are several Shopify apps and browser add-ons that make use of the [Shopify API](/api/metafield) to let you manage your metafields:
+
+* [Shopify FD](http://shopify.freakdesign.com.au/#ShopifyFD) to create and edit metafields
+* [Custom Fields](http://shopify.freakdesign.com.au/#customfields) to edit your metafields
+* [Metafields Editor](http://apps.shopify.com/metafields-editor)
+* [Metafields2](http://apps.shopify.com/metafields2)
+
+A metafield consists of a namespace, a key, a value, and a description (optional). Use the namespace to group different metafields together in a logical way.
+
+You can also specify metafields as either integers or strings. That way, you’ll end up with the right type of data when you use the metafields in your Liquid.
+
+For example, if you’ve added two metafields to a product, and each metafield has the following attributes:
+
+| Namespace | +Key | +Value | +
|---|---|---|
| instructions | +Wash | +Cold | +
| instructions | +Dry | +Tumble | +
Input
+{% highlight html %} +{% raw %} +{% assign instructions = product.metafields.instructions %} +{% assign key = 'Wash' %} +Output
+{% highlight html %} +Wash: Cold +Wash: Cold +Wash: Cold +{% endhighlight %} + +You can use the following in product.liquid to output your second metafield: + +{% highlight html %} +{% raw %} +{% assign instructions = product.metafields.instructions %} +{% assign key = 'Dry' %} +Input
+{% highlight html %} +{% raw %} +Output
+{% highlight html %} +Wash: Cold +Dry: Tumble +{% endhighlight %} + +The key of a metafield is{% raw %}{{ field | first }}{% endraw %}, while the value is {% raw %}{{ field | last }}{% endraw %}.
diff --git a/documentation/objects/order.md b/documentation/objects/order.md
new file mode 100644
index 0000000..47ddaf4
--- /dev/null
+++ b/documentation/objects/order.md
@@ -0,0 +1,349 @@
+---
+layout: default
+title: order
+
+nav:
+ group: Liquid Variables
+---
+
+# order
+
+The order object can be accessed in order email templates, the Thank You page of the checkout, as well as in apps such as Order Printer.
+
+The order object has the following attributes:
+
+
+{% table_of_contents %}
+
+
+{% anchor_link "order.billing_address", "order-billing_address" %}
+
+Returns the billing address of the order.
+
+
+
+
+
+{% anchor_link "order.cancelled", "order-cancelled" %}
+
+Returns true if an order is cancelled, returns falseif it not.
Returns the timestamp of when an order was cancelled. Use the date filter to format the timestamp.
+ + + + + + + + + +{% anchor_link "order.cancel_reason", "order-cancel_reason" %} + +Returns the cancellation reason of an order, if it was cancelled.
+ + + + + + + + +{% anchor_link "order.created_at", "order-created_at" %} + +Returns the timestamp of when an order was created. Use the date filter to format the timestamp.
+ + + + + + + + + + +{% anchor_link "order.customer", "order-customer" %} + +Returns the customer associated to the order. + + + + + + + + +{% anchor_link "order.customer_url", "order-customer_url" %} + +
Returns the URL of the customer's account page.
+ +Input
+Output
+Returns an array of discounts for an order.
+ +Input
+Output
+Returns the email associated with an order.
+ + + + + + + + +{% anchor_link "order.financial_status", "order-financial_status" %} + +Returns the financial status of an order. The possible values are:
+ +- pending +- authorized +- paid +- partially_paid +- refunded +- partially_refunded +- voided + + + + + + + + +{% anchor_link "order.fulfillment_status", "order-fulfillment_status" %} + +Returns the fulfillment status of an order.
+ + + + + + + + +{% anchor_link "order.line_items", "order-line_items" %} + +Returns an array of line items from the order.
+ + + + + + + + + +{% anchor_link "order.location", "order-location" %} + +POS Only. Displays the physical location of the order. You can configure locations in the Locations settings of the admin.
+ + + + + + + + + +{% anchor_link "order.name", "order-name" %} + +Returns the name of the order, in the format set in the Standards & formats section of the General Settings. + +Input
+Output
+Returns the integer representation of the order name.
+ +Input
+Output
+Returns the shipping price of an order. Use a money filter to return the value in a monetary format.
+ + + + + + + + +{% anchor_link "order.subtotal_price", "order-subtotal_price" %} + +Returns the subtotal price of an order. Use a money filter to return the value in a monetary format.
+ + + + + + + + + +{% anchor_link "order.tax_lines", "order-tax_lines" %} + +Returns an array of tax_line variables for an order.
+ +Input
+Output
+Returns the order's tax price. Use a money filter to return the value in a monetary format.
+ + + + + + + + + + + +{% anchor_link "order.total_price", "order-total_price" %} + +Returns the total price of an order. Use a money filter to return the value in a monetary format.
+ + + + + + + + + + +{% anchor_link "order.transactions", "order-transactions" %} + +Returns an array of transactions from the order.
+ + + + + + + + diff --git a/documentation/objects/page-description.md b/documentation/objects/page-description.md new file mode 100644 index 0000000..f8f1406 --- /dev/null +++ b/documentation/objects/page-description.md @@ -0,0 +1,38 @@ +--- +layout: default +title: page_description + +nav: + group: Liquid Variables +--- + +# page_description + +Returns the description of a **Product**, **Page**, or **Blog Article**, set in their respective Admin pages. + +{{ '/themes/page_desc.jpg' | image }} + +Input
+Output
+Input
+Output
+page object has the following attributes:
+
+
+{% table_of_contents %}
+
+
+
+{% anchor_link "page.author", "page.author" %}
+
+Returns the author of a page.
+ + + + + + + +{% anchor_link "page.content", "page-content" %} + +Returns the content of a page.
+ + + + + + + + +{% anchor_link "page.handle", "page-handle" %} + +Returns the handle of the page.
+ + + + + + + + + +{% anchor_link "page.id", "page-id" %} + +Returns the id of the page.
+ + + + + + + + + +{% anchor_link "page.published_at", "page-published_at" %} + +Returns the timestamp of when the page was created. Use the date filter to format the timestamp. + + + + + + + + + + +{% anchor_link "page.template_suffix", "page-template_suffix" %} + +Returns the name of the custom page template assigned to the page, without thepage. prefix nor the .liquid suffix. Returns nil if a custom template is not assigned to the page.
+
+Input
+Output
+Returns the title of a page.
+ + + + + + + + + + +{% anchor_link "page.url", "page-url" %} + +Returns the relative URL of the page.
+ +Input
+Output
+paginate object. You can also use the default_pagination filter for a quicker alternative.
+
+{% block "note-information" %}
+The paginate object can only be used within paginate tags.
+{% endblock %}
+
+
+The paginate object has the following attributes:
+
+
+{% table_of_contents %}
+
+
+
+
+
+
+{% anchor_link "paginate.current_page", "paginate-current_page" %}
+
+Returns the number of the current page.
+ + + + + + + + + + +{% anchor_link "paginate.current_offset", "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 and are on the third page, paginate.current_offset would return 10.
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.
Returns an array of all parts of the pagination. A part is a component used to build the navigation for the pagination.
+
+
+
+
+
+
+
+
+{% anchor_link "paginate.next", "paginate-next" %}
+
+Returns the part variable for the Next link in the pagination navigation.
+
+
Input
+Output
+Input
+Output
+part returned by the paginate.parts array represents a link in the pagination's navigation.
+
+{% block "note-information" %}
+The part object is only accessible through the paginate object, and can only be used within paginate tags.
+{% endblock %}
+
+The example below shows how the part object's attributes can be accessed through a for loop that goes through the paginate.parts array.
+
+Input
+Output
+ + + + +Thepart object has the following attributes:
+
+
+{% table_of_contents %}
+
+
+
+
+
+
+
+
+
+
+{% anchor_link "part.is_link", "part-is_link" %}
+
+Returns true if the part is a link, returns false if it is not.
+
+
+
+
+
+
+
+
+
+
+{% anchor_link "part.title", "part-title" %}
+
+Returns the title of the part.
+
+
+
+
+
+
+
+
+
+
+
+
+
+{% anchor_link "part.url", "part-url" %}
+
+Returns the URL of the part.
+
diff --git a/documentation/objects/product.md b/documentation/objects/product.md
new file mode 100644
index 0000000..29d648a
--- /dev/null
+++ b/documentation/objects/product.md
@@ -0,0 +1,421 @@
+---
+layout: default
+title: product
+
+nav:
+ group: Liquid Variables
+---
+
+# product
+
+The product object has the following attributes:
+
+
+{% table_of_contents %}
+
+
+
+{% anchor_link "product.available", "product-available" %}
+
+Returns true if a product is available for purchase. Returns falseif 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."
Returns an array of all of the collections a product belongs to.
+ +Input
+Output
+Returns the highest compare at price. Use one of the money filters to return the value in a monetary format.
+ + + + + + + + + + +{% anchor_link "product.compare_at_price_min", "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.
+ + + + + + + + + + + +{% anchor_link "product.compare_at_price_varies", "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.
Returns the description of the product. Alias for product.description.
+ + + + + + + + +{% anchor_link "product.description", "product-description" %} + +Returns the description of the product.
+ + + + + + + + + +{% anchor_link "product.featured_image", "product-featured_image" %} + +Returns the relative URL of the product's featured image.
+ + + + + + + + + + + +{% anchor_link "product.handle", "product-handle" %} + +Returns the handle of a product. + + + + + + + + + + +{% anchor_link "product.id", "product-id" %} + +Returns the id of the product.
+ + + + + + + + + +{% anchor_link "product.images", "product-images" %} + +Returns an array of the product's images. Use the product_img_url filter to link to the product image on Shopify's Content Delivery Network. + +Input
+Output
+
+
+
+{% endraw %}{% endhighlight %}
+Returns an array of the product's options.
+ +Input
+Output
+Input
+Output
+Returns the price of the product. Use one of the money filters to return the value in a monetary format.
+ + + + + + + + +{% anchor_link "product.price_max", "product-price_max" %} + +Returns the highest price of the product. Use one of the money filters to return the value in a monetary format.
+ + + + + + + + + +{% anchor_link "product.price_min", "product-price_min" %} + +Returns the lowest price of the product. Use one of the money filters to return the value in a monetary format.
+ + + + + + + + + +{% anchor_link "product.price_varies", "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.
Returns an array of all of the product's tags. The tags are returned in alphabetical order.
+ +Input
+Output
+product. prefix nor the .liquid suffix. Returns nil if a custom template is not assigned to the product.
+
+Input
+Output
+Returns the title of the product.
+ + + + + + + + + +{% anchor_link "product.type", "product-type" %} + +Returns the type of the product.
+ + + + + + + + + +{% anchor_link "product.url", "product-url" %} + +Returns the relative URL of the product.
+ +Input
+Output
+Returns an array the product's variants. + + + + + + + + + + + +{% anchor_link "product.vendor", "product-vendor" %} + +
Returns the vendor of the product.
+ + diff --git a/documentation/objects/search.md b/documentation/objects/search.md new file mode 100644 index 0000000..9efa4d6 --- /dev/null +++ b/documentation/objects/search.md @@ -0,0 +1,106 @@ +--- +layout: default +title: search + +nav: + group: Liquid Variables +--- + +# search + +Thesearch object has the following attributes:
+
+
+{% table_of_contents %}
+
+
+
+{% anchor_link "search.performed", "search-performed" %}
+
+Returns true if an HTML form with the attribute action="/search" was submitted successfully. This allows you to show content based on whether a search was performed or not.
+
+search.results.
+
+Returns the number of results found.
+ + + + + + + + +{% anchor_link "search.terms", "search-terms" %} + +Returns the string that was entered in the search input box. Use the highlight filter to apply a different style to any instances in the search results that match up with search.terms.
Input
+{% highlight html %}{% raw %} +{{ item.content | highlight: search.terms }} +{% endraw %}{% endhighlight %} + +Output
+shipping_method object has the following attributes:
+
+
+{% table_of_contents %}
+
+
+{% anchor_link "shipping_method.handle", "shipping_method-handle" %}
+
+Returns the handle of the shipping method. The price of the shipping rate is appended to the end of the handle.
+
+Input
+Output
+Returns the price of the shipping method. Use a money filter to return the value in a monetary format.
+ + +Input
+Output
+Input
+Output
+shop object has the following attributes:
+
+
+{% table_of_contents %}
+
+
+
+
+
+
+{% anchor_link "shop.collections_count", "shop-collections_count" %}
+
+Returns the number of collections in a shop.
+ + + + + + + + +{% anchor_link "shop.currency", "shop-currency" %} + +Returns the shop's currency in three-letter format (ex: USD).
+ + + + + + + + + + + + +{% anchor_link "shop.description", "shop-description" %} + +Returns the description of the shop.
+ + + + + + + + + + + +{% anchor_link "shop.domain", "shop-domain" %} + +Returns the primary domain of the shop.
+ + + + + + + + + + + + +{% anchor_link "shop.email", "shop-email" %} + +Returns the shop's email address.
+ + + + + + + + + +{% anchor_link "shop.enabled_payment_types", "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.
+ +The available values for this array are: + +- visa +- master +- american_express +- paypal +- jcb +- diners_club +- maestro +- google_wallet +- discover +- solo +- switch +- laser +- dankort +- forbrugsforeningen +- dwolla +- bitcoin + + + + + + + + + + + +{% anchor_link "shop.metafields", "shop-metafields" %} + +Returns the shop's metafields. Metafields can only be set using the Shopify API .
+ + + + + + + + + + + +{% anchor_link "shop.money_format", "shop-money_format" %} + +Returns a string that is used by Shopify to format money without showing the currency.
+ + + + + + + + + + + + + +{% anchor_link "shop.money_with_currency", "shop-money_with_currency" %} + +Returns a string that is used by Shopify to format money while also displaying the currency.
+ + + + + + + + + + +{% anchor_link "shop.name", "shop-name" %} + +Returns the shop's name.
+ + + + + + + + + + + +{% anchor_link "shop.permanent_domain", "shop-permanent_domain" %} + +Returns the .myshopify.com URL of a shop.
+ + + + + + + + + + + +{% anchor_link "shop.products_count", "shop-products_count" %} + +Returns the number of products in a shop.
+ + + + + + + + + + +{% anchor_link "shop.types", "shop-types" %} + +Returns an array of all unique product types in a shop.
+ +{% highlight html %}{% raw %} +{% for product_type in shop.types %} + {{ product_type | link_to_type }} +{% endfor %} +{% endraw %}{% endhighlight %} + + + + + + + + + + +{% anchor_link "shop.url", "shop-url" %} + +Returns the full URL of a shop.
+ +Input
+Output
+Returns an array of all unique vendors in a shop.
+ +{% highlight html %}{% raw %} +{% for product_vendor in shop.vendors %} + {{ product_vendor | link_to_vendor }} +{% endfor %} +{% endraw %}{% endhighlight %} + + + + + + + + + + + diff --git a/documentation/objects/tablerow.md b/documentation/objects/tablerow.md new file mode 100644 index 0000000..3755278 --- /dev/null +++ b/documentation/objects/tablerow.md @@ -0,0 +1,140 @@ +--- +layout: default +title: tablerow + +nav: + group: Liquid Variables +--- + +# tablerow + +Thetablerow object is used within the tablerow tag. It contains attributes of its parent for loop.
+
+
+{% table_of_contents %}
+
+
+
+
+{% anchor_link " tablerow.length", "tablerow-length" %}
+
+Returns the number of iterations of the tablerow loop.
+ + + + + + + + + + +{% anchor_link " tablerow.index", "tablerow-index" %} + +Returns the current index of the tablerow loop, starting at 1. + + + + + + + + +{% anchor_link " tablerow.index0", "tablerow-index0" %} + +Returns the current index of the tablerow loop, starting at 0. + + + + + + + + +{% anchor_link " tablerow.rindex", "tablerow-rindex" %} + +Returns tablerow.index in reverse order. + + + + + + + + +{% anchor_link " tablerow.rindex0", "tablerow-rindex0" %} + +Returns tablerow.index0 in reverse order. + + + + + + + + +{% anchor_link " tablerow.first", "tablerow-first" %} + +Returnstrue if it's the first iteration of the tablerow loop. Returns false if it is not the first iteration.
+
+
+
+
+
+
+
+
+
+{% anchor_link "tablerow.last", "tablerow-last" %}
+
+Returns true if it's the last iteration of the tablerow loop. Returns false if it is not the last iteration.
+
+
+
+
+
+
+
+
+
+{% anchor_link "tablerow.col", "tablerow-col" %}
+
+Returns the index of the current row, starting at 1.
+
+
+
+
+
+
+
+
+{% anchor_link "tablerow.col0", "tablerow-col0" %}
+
+Returns the index of the current row, starting at 0.
+
+
+
+
+
+
+
+
+
+{% anchor_link "tablerow.col_first", "tablerow-col_first" %}
+
+Returns true if the current column is the first column in a row, returns false if it is not.
+
+
+
+
+
+
+
+
+
+{% anchor_link " tablerow.col_last", "tablerow-col_last" %}
+
+Returns true if the current column is the last column in a row, returns false if it is not.
+
+
+
diff --git a/documentation/objects/tax_line.md b/documentation/objects/tax_line.md
new file mode 100644
index 0000000..8a21691
--- /dev/null
+++ b/documentation/objects/tax_line.md
@@ -0,0 +1,114 @@
+---
+layout: default
+title: tax_line
+
+nav:
+ group: Liquid Variables
+---
+
+# tax_line
+
+The tax_line object has the following attributes:
+
+
+{% table_of_contents %}
+
+
+
+{% anchor_link "tax_line.title", "tax_line-title" %}
+
+Returns the title of the tax.
+
+Input
+Output
+Input
+Output
+Input
+Output
+Input
+Output
+template returns the name of the template used to render the current page, with the .liquid extension omitted.
+
+Input
+Output
+theme object contains information about published themes in a shop. You can also use themes to iterate through both themes.
+
+Input
+{% highlight html %}{% raw %} +{% for t in themes %} + {{ t.role }} theme: {{ t.name }} +{% endfor %} +{% endraw %}{% endhighlight %} + +Output
+theme object has the following attributes:
+
+
+{% table_of_contents %}
+
+
+
+
+
+{% anchor_link "theme.id", "theme-id" %}
+
+Returns the theme's id. This is useful for when you want to link a user directly to the theme's Theme Settings.
+
+Input
+Output
+main or mobile.
+
+
+
+
+
+
+
+{% anchor_link "theme.name", "theme-name" %}
+
+Returns the name of the theme.
+
+
+
+
+
diff --git a/documentation/objects/transaction.md b/documentation/objects/transaction.md
new file mode 100644
index 0000000..b61fa4c
--- /dev/null
+++ b/documentation/objects/transaction.md
@@ -0,0 +1,122 @@
+---
+layout: default
+title: transaction
+
+nav:
+ group: Liquid Variables
+---
+
+# transaction
+
+The transaction object has the following attributes:
+
+
+{% table_of_contents %}
+
+
+{% anchor_link "transaction.id", "transaction-id" %}
+
+Returns the id of the transaction.
+
+
+
+
+
+
+
+{% anchor_link "transaction.amount", "transaction-amount" %}
+
+Returns the amount of the transaction. Use one of the money filters to return the value in a monetary format.
+
+
+
+
+
+
+
+{% anchor_link "transaction.name", "transaction-name" %}
+
+Returns the name of the transaction.
+
+Input
+Output
+Returns the timestamp of when the transaction was created. Use the date filter to format the timestamp.
+ + + + + + + + + + + + + + + +{% anchor_link "transaction.gateway", "transaction-gateway" %} + +Returns the name of the payment gateway used for the transaction. + +Input
+Output
+variant object has the following attributes:
+
+
+{% table_of_contents %}
+
+
+
+
+{% anchor_link "variant.available", "variant-available" %}
+
+Returns true if the variant is available to be purchased, or false if it not. In order for a variant to be available, its variant.inventory_quantity must be greater than zero and its variant.inventory_policy must be continue.
+
+
+
+
+
+
+
+
+
+{% anchor_link "variant.barcode", "variant-barcode" %}
+
+Returns the variant's barcode.
+ + + + + + + + + + +{% anchor_link "variant.compare_at_price", "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.
+ + + + + + + + + + + +{% anchor_link "variant.id", "variant-id" %} + +Returns the variant's unique id.
+ + + + + + + + + +{% anchor_link "variant.inventory_management", "variant-inventory_management" %} + +Returns the variant's inventory tracking service.
+ + + + + + +{% anchor_link "variant.inventory_policy", "variant-inventory_policy" %} + +Returns the stringcontinue 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.
+
+
+
+
+
+
+
+{% anchor_link "variant.inventory_quantity", "variant-inventory_quantity" %}
+
+Returns the variant's inventory quantity.
+ + + + + + + + + + +{% anchor_link "variant.option1", "variant-option1" %} + +Returns the value of the variant's first option. + + + + + + + + + + +{% anchor_link "variant.option2", "variant-option2" %} + +Returns the value of the variant's second option. + + + + + + + + + + +{% anchor_link "variant.option3", "variant-option3" %} + +Returns the value of the variant's third option. + + + + + + + + + +{% anchor_link "variant.price", "variant-price" %} + +Returns the variant's price. Use one of the money filters to return the value in a monetary format.
+ + + + + + + + + +{% anchor_link "variant.sku", "variant-sku" %} + +Returns the variant's SKU.
+ + + + + + + + + +{% anchor_link "variant.title", "variant-title" %} + +Returns the concatenation of all the variant's option values, joined by a /.
Input
+Output
+Returns the variant's weight. Use the weight_with_unit filter to convert it to the shop's weight format.
+ + + + diff --git a/documentation/tags/control-flow-tags.md b/documentation/tags/control-flow-tags.md new file mode 100644 index 0000000..e84cf28 --- /dev/null +++ b/documentation/tags/control-flow-tags.md @@ -0,0 +1,176 @@ +--- +layout: default +title: Control Flow Tags +landing_as_article: true + +nav: + group: Liquid Documentation + weight: 1 +--- + +# Control Flow Tags + +Control Flow tags determine which block of code should be executed based on different conditions. + + +{% table_of_contents %} + + + + + + + +{% anchor_link "if", "if" %} + +Executes a block of code only if a certain condition is met.
+ +Input
+ +Output
+ +Adds more conditions within an if or unless block.
Input
+ +Output
+ +Creates a switch statement to compare a variable with different values. case initializes the switch statement, and when compares its values.
Input
+ +Output
+ +Similar to if, but executes a block of code only if a certain condition is not met.
Input
+ +Output
+ +{% %}.
+
+Certain tags, such as for and cycle can take on parameters. Details for each parameter can be found in their respective sections.
+
+Tags can be broken down into four categories:
+
+- [Control Flow Tags](/themes/liquid-documentation/tags/control-flow-tags/)
+- [Iteration Tags](/themes/liquid-documentation/tags/iteration-tags/)
+- [Theme Tags](/themes/liquid-documentation/tags/theme-tags/)
+- [Variable Tags](/themes/liquid-documentation/tags/variable-tags/)
\ No newline at end of file
diff --git a/documentation/tags/iteration-tags.md b/documentation/tags/iteration-tags.md
new file mode 100644
index 0000000..a394c8b
--- /dev/null
+++ b/documentation/tags/iteration-tags.md
@@ -0,0 +1,459 @@
+---
+layout: default
+title: Iteration Tags
+landing_as_article: true
+
+nav:
+ group: Liquid Documentation
+ weight: 1
+---
+
+# Iteration Tags
+
+Iteration Tags are used to run a block of code repeatedly.
+
+
+{% table_of_contents %}
+
+
+
+
+
+
+
+
+
+
+{% anchor_link "for", "for" %}
+
+Executes a block of code repeatedly. For a full list of attributes available within a for loop, see forloop (object).
+ +For loops can only output a maximum of 50 results per page. In cases where there are more than 50 results, use the paginate tag to split them across multiple pages. + +Input
+ +Output
+ +Input
+ +Output
+ +Input
+ +Output
+ +Input
+ +Output
+ +Input
+Output
+cycle is called, the next string that was passed as a parameter is output.
+
+cycle must be used within a for loop block.
+
+
+Input
+Output
+cycle include:
+
+- applying odd/even classes to rows in a table
+- applying a unique class to the last product thumbnail in a row
+
+cycle accepts a parameter called cycle group in cases where you need multiple cycle blocks in one template. If no name is supplied for the cycle group, then it is assumed that multiple calls with the same parameters are one group.
+
+The example below shows why cycle groups are necessary when there are multiple instances of the cycle block.
+ +In the code above, if the first collection only has two products, the second collection loop will continue the cycle where the first one left off. This will result in this undesired output:
To avoid this, cycle groups are used for each cycle block, as shown below.
With the code above, the two cycle blocks are independent of each other. The result is shown below:
Generates an HTML <table>. Must be wrapped in an opening <table> and closing </table> HTML tags. For a full list of attributes available within a tablerow loop, see tablerow (object).
Input
+ +Output
+ +| + Cool Shirt + | ++ Alien Poster + | ++ Batman Poster + | ++ Bullseye Shirt + | ++ Another Classic Vinyl + | ++ Awesome Jeans + | +
Input
+ +Output
+ +| + Cool Shirt + | ++ Alien Poster + | +
| + Batman Poster + | ++ Bullseye Shirt + | +
| + Another Classic Vinyl + | ++ Awesome Jeans + | +
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.
Input
+ +Output
+ +with parameter assigns a value to a variable inside a snippet that shares the same name as the snippet.
+
+For example, we can have a snippet named **color.liquid** which contains the following:
+
+{% highlight html %}{% raw %}
+color: '{{ color }}'
+shape: '{{ shape }}'
+{% endraw %}{% endhighlight %}
+
+Within **theme.liquid**, we can include the **color.liquid** snippet as follows:
+
+{% highlight html %}{% raw %}
+{% assign shape = 'circle' %}
+{% include 'color' %}
+{% include 'color' with 'red' %}
+{% include 'color' with 'blue' %}
+{% assign shape = 'square' %}
+{% include 'color' with 'red' %}
+{% endraw %}{% endhighlight %}
+
+The output will be:
+
+{% highlight html %}{% raw %}
+color: shape: 'circle'
+color: 'red' shape: 'circle'
+color: 'blue' shape: 'circle'
+color: 'red' shape: 'square'
+{% endraw %}{% endhighlight %}
+
+
+
+
+
+
+
+
+
+
+
+{% anchor_link "form", "form" %}
+
+Creates an HTML <form> element with all the necessary attributes (action, id, etc.) and <input> to submit the form successfully.
+
+Input
+Output
+article object as a parameter.
+
+Input
+Output
+Input
+Output
+Input
+Output
+customer.new_address. When editing an existing address, include the parameter address.
+
+Input
+Output
+Input
+Output
+Input
+Output
+none.
+
+{% highlight html %}{% raw %}
+{% layout none %}
+{% endraw %}{% endhighlight %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{% anchor_link "paginate", "paginate" %}
+
+Splitting products, blog articles, and search results across multiple pages is a necessary component of theme design as you are limited to 50 results per page in any for loop.
+
+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, as shown in the example below:
+
+{% highlight html %}{% raw %}
+{% paginate collection.products by 5 %}
+ {% for product in collection.products %}
+
+ {% endfor %}
+{% endpaginate %}
+{% endraw %}{% endhighlight %}
+
+The by parameter is followed by an integer between 1 and 50 that tells the paginate tag how many results it should output per page.
+
+
+Within paginate tags, you can access attributes of the paginate object. This includes the attributes to output the links required to navigate within the generated pages.
+
+
+{% comment %}
+
+{% block "note-caution" %}
+Accessing any attributes of the array you are paginating before the opening paginate tag will cause errors. To avoid this, make sure any variables
+{% endblock %}
+
+
+**Bad Example**
+Allows output of Liquid code on a page without being parsed.
+ +Input
+ +{% raw %}{{ 5 | plus: 6 }}{% endraw %} is equal to 11.Output
+ +{{ 5 | plus: 6 }} is equal to 11.Creates a new variable.
+ +Input
+ +Output
+ +Input
+ +Output
+ +Captures the string inside of the opening and closing tags and assigns it to a variable. By default, variables created through {% capture %} are strings; use the to_number filter to convert the string into a number.
+ + +Input
+ +Output
+ +Input
+ +{% highlight html %}{% raw %} +{% increment variable %} +{% increment variable %} +{% increment variable %} +{% endraw %}{% endhighlight %} + +Output
+ +increment tag are independent from variables created through assign or capture.
+
+In the example below, a variable named "var" is created through assign. The increment tag is then used several times on a variable with the same name. However, note that the increment tag does not affect the value of "var" that was created through assign.
+
+Input
+ +Output
+ +Input
+ +{% highlight html %}{% raw %} +{% decrement variable %} +{% decrement variable %} +{% decrement variable %} +{% endraw %}{% endhighlight %} + +Output
+ +decrement are independent from variables created through assign or capture.
+
+
+
+
+