The cart object

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 name attribute with the following syntax:

You can add a double underscore (__) prefix to an attribute name to make it private. Private attributes behave like other cart attributes except that they can't be read from Liquid or the Ajax API. You can use them for data that doesn't affect the page rendering, which allows for more effective page caching.

Shown below is a basic example of how to use an HTML input of type "text" to capture information on the cart page. You can also create a cart.attributes input by using the Shopify UI elements generator.

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.

cart.cart_level_discount_applications

Returns an array of any cart-specific discount applications for the cart.

cart.currency

Returns the currency of the cart. If your store uses multi-currency, then the cart.currency is the same as the customer's local (presentment) currency. Otherwise, the cart currency is the same as your store currency.

To return the list of currencies that are accepted by your store, see the shop.enabled_currencies object.

cart.discount_applications

Returns an array of discount applications for the cart.

cart.item_count

Returns the number of items inside the cart.

cart.items

Returns all of the line items in the cart.

cart.items_subtotal_price

Returns the sum of the cart's line-item prices after any line-item discount. The subtotal doesn't include taxes (unless taxes are included in the prices), cart discounts, or shipping costs.

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.

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.

cart.original_total_price

Returns the subtotal of the cart before any discounts have been applied.

cart.taxes_included

Returns true if taxes are included in your products' prices. Otherwise, returns false.

This can be set in your store’s Tax settings. If you've activated Include or exclude tax based on your customer’s country, then the value reflects the tax requirements of your customer’s country.

cart.total_discount

Returns the total of all discounts (the amount saved) for the cart.

cart.total_price

Returns the total price of all of the items in the cart after discounts have been applied.

cart.total_weight

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