The cart object
cart object has the following 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.
Returns an array of any cart-specific discount applications for the cart.
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.
Returns an array of discount applications for the cart.
Returns the number of items inside the cart.
Returns all of the line items in the cart.
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 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 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.
Returns the subtotal of the cart before any discounts have been applied.
true if taxes are included in your products' prices. Otherwise, returns
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.
Returns the total of all discounts (the amount saved) for the cart.
Returns the total price of all of the items in the cart after discounts have been applied.
Returns the total weight of all of the items in the cart.