Liquid Template Variables - cart: Difference between revisions
From Spiffy Stores Knowledge Base
No edit summary |
|||
| Line 26: | Line 26: | ||
== <code>cart.total_price</code> == | == <code>cart.total_price</code> == | ||
Returns the total price of all items in the shopping cart. | |||
For example: | |||
<pre>The total of your cart is: {{ cart.total_price | money }}</pre> | |||
== <code>cart.total_weight</code> == | == <code>cart.total_weight</code> == | ||
Revision as of 19:14, 11 September 2008
The liquid template variable cart has the following attributes:
cart.item_count
Returns the number of items currently in the shopping cart.
For example:
{% if cart.item_count == 0 %}
Your shopping cart is empty!
{% else %}
You have <a href="/cart">{{ cart.item_count }} {{ cart.item_count | pluralize: 'item', 'items' }}</a> in your cart
{% endif %}
cart.items
Returns all the items in the shopping cart. Each item is a Line Item.
For example:
<ul>
{% for item in cart.items %}
<li>{{ item.title }}</li>
{% endfor %}
</ul>
cart.total_price
Returns the total price of all items in the shopping cart.
For example:
The total of your cart is: {{ cart.total_price | money }}