Liquid Template Variables - cart: Difference between revisions

From Spiffy Stores Knowledge Base
Jump to: navigation, search
Admin (talk | contribs)
New page: The liquid template variable ''cart'' has the following attributes: == <code>cart.item_count</code> == Returns the number of items currently in the shopping cart. For example: <pre>{% ...
 
Admin (talk | contribs)
No edit summary
Line 15: Line 15:
== <code>cart.items</code> ==
== <code>cart.items</code> ==


Returns all the items in the shopping cart. Each item is a  [[Liquid Template Variables - LineItem|LineItem]].
Returns all the items in the shopping cart. Each item is a  [[Liquid Template Variables - Line Item|Line Item]].


For example:
For example:

Revision as of 19:12, 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

cart.total_weight

cart.note

cart.attributes