Difference between revisions of "Shopify Liquid"
From the Directed Edge Developer Base
Line 1: | Line 1: | ||
== Liquid Variables supported by Directed Edge == | == Liquid Variables supported by Directed Edge == | ||
− | === groups === | + | === <tt>groups</tt> === |
The liquid variable groups contain all recommendation types that are available for the requested page. Each group has following properties: | The liquid variable groups contain all recommendation types that are available for the requested page. Each group has following properties: | ||
{| class="variable-ref-table" | {| class="variable-ref-table" | ||
Line 39: | Line 39: | ||
|} | |} | ||
− | === bundle === | + | === <tt>bundle</tt> === |
The bundle variable is used to access supplementary information about bundles | The bundle variable is used to access supplementary information about bundles | ||
− | {| class=" | + | {| class="variable-ref-table" |
|- | |- | ||
| text || Bundle's buy message (e.g. 'Buy both for 20$') which can be adjusted in the [http://shopify.directededge.com/settings#bundle Directed Edge for Shopify Bundle Settings] page. | | text || Bundle's buy message (e.g. 'Buy both for 20$') which can be adjusted in the [http://shopify.directededge.com/settings#bundle Directed Edge for Shopify Bundle Settings] page. |
Revision as of 01:02, 10 October 2013
Liquid Variables supported by Directed Edge
groups
The liquid variable groups contain all recommendation types that are available for the requested page. Each group has following properties:
label | A formatted label of the group. E.g. 'Recommended Items', 'Recently Viewed', etc. Those labels can be customized in the Directed Edge for Shopify Appearance Settings page. |
handle | A machine friendly identifier for the group (e.g. bundle, recommended_product, etc.) |
products | A list of products that are recommended for this group.
The following example would print title and price of all products in all available groups: {% for group in groups %}
<ul>
{% for product in group.products %}
<li>
<b>{{ product.title }}</b><br />
{{ product.price | money }}
{% endfor %}
</ul>
{% endfor %} A detailed description of all product's properties can be found here. |
bundle | A boolean field that indicates if this group is a bundle. This is useful to render custom content for that particular group. The following snippet would display both product images separated by a plus sign and followed by a equals sign and the bundle price:
{% for group in groups %}
{% if group.bundle %}
{{ group.products.first.featured_image | product_img_url: 'small' }}
+
{{ group.products.last.featured_image | product_img_url: 'small' }}
=
{{ bundle.price }}
{% else %}
<!-- render other content here -->
{% endif %}
{% endfor %} |
bundle
The bundle variable is used to access supplementary information about bundles
text | Bundle's buy message (e.g. 'Buy both for 20$') which can be adjusted in the Directed Edge for Shopify Bundle Settings page. |
price | The total price of a bundle calculated using the method specified in the Directed Edge for Shopify Bundle Settings page. As any price it can be formatted with the price filter (e.g. {{ bundle.price | money }} |
buy_link | A link that will add both products to the shopping cart and will present the user a product variant chooser if necessary. |