cart

The cart object has the following 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:

attributes[attribute-name]

Shown below is a basic example of how to use an HTML input of type "text" to capture information on the cart page.

<label>What is your Pet's name?</label>
<input type="text" name="attributes[your-pet-name]" value="{{ cart.attributes.your-pet-name }}" />

cart.attributes can be accessed in order email templates, the order status page of the checkout, as well as in apps such as Order Printer.

Input

{{ attributes.your-pet-name }}

Output

Haku

For more examples on how to use cart attributes, see Ask a customer for additional information.

cart.item_count

Returns the number of items inside the cart.

Input

{{ cart.item_count }} {{ cart.item_count | pluralize: 'Item', 'Items' }} ({{ cart.total_price | money }})

Output

25 Items ($53.00)

cart.items

Returns all of the line items in the cart.

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.

<label>Gift note:</label>
<textarea rows="100" cols="20">{{ cart.note }}</textarea>

Note

There can only be one instance of {{ cart.note }} 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.

cart.note can be accessed in order email templates, the order status 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

{{ note }}

Output

Hope you like the gift, Kylea!

cart.total_price

Returns the total price of all of the items in the cart.

cart.total_weight

Returns the total weight of all of the items in the cart.

Want to discuss this page?

Visit the Shopify Community