Cart
The cart
object has the following attributes:
In this article
cart.attributes
cart.attributes
allow the capturing of more information on the cart page. This is done by giving an input a name
attribute 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>Sở thích của bạn là gi?</label>
<input type="text" name="attributes[so-thich]" value="{{ cart.attributes.so-thich }}" />
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.so-thich }}
Output
Xem phim
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
10 Items (200.000đ)
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>Ngày giao hàng:</label>
<textarea rows="100" cols="20">{{ cart.note }}</textarea>
Note
There can only be one instance of 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.
Input
{{ note }}
Output
Giao ngày 30/06/2016
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.