VOOZH about

URL: https://shopify.dev/docs/api/liquid/objects/cart

⇱ Liquid objects: cart


Skip to main content

A customer’s cart.

Properties

Anchor to
attributesattributes

Additional attributes entered by the customer with the cart.

To learn more about capturing cart attributes, refer to the cart template.

Anchor to
cart_level_discount_applicationscart_level_discount_applications

The cart-specific discount applications for the cart.

Anchor to
checkout_charge_amountcheckout_charge_amount

The amount that the customer will be charged at checkout in the currency's subunit.

The value is output in the customer's local (presentment) currency.

For currencies without subunits, such as JPY and KRW, tenths and hundredths of a unit are appended. For example, 1000 Japanese yen is output as 100000.

Tip

Use money filters to output a formatted price.

Tip:

Use money filters to output a formatted price.

Tip: Use <a href="/docs/api/liquid/filters/money-filters">money filters</a> to output a formatted price.

Anchor to
currencycurrency

The currency of the cart.

If the store uses multi-currency, then this is the same as the customer's local (presentment) currency. Otherwise, it's the same as the store currency.

Tip

You can output the store's available currencies using shop.enabled_currencies.

Tip:

You can output the store's available currencies using shop.enabled_currencies.

Tip: You can output the store&#39;s available currencies using <a href="/docs/api/liquid/objects/shop#shop-enabled_currencies"><code><span class="PreventFireFoxApplyingGapToWBR">shop.enabled<wbr/>_currencies</span></code></a>.

Anchor to
discount_applicationsdiscount_applications

The discount applications for the cart.

Anchor to
duties_includedduties_included

Returns true if duties are included in the prices of products in the cart. Returns false if not.

Anchor to
empty?empty?

Returns true if there are no items in the cart. Return's false if there are.

Anchor to
item_countitem_count

The number of items in the cart.

Anchor to
itemsitems
array of line_item

The line items in the cart.

Anchor to
items_subtotal_priceitems_subtotal_price

The total price of all of the items in the cart in the currency's subunit, after any line item discounts. This doesn't include taxes (unless taxes are included in the prices), cart discounts, or shipping costs.

The value is output in the customer's local (presentment) currency.

For currencies without subunits, such as JPY and KRW, tenths and hundredths of a unit are appended. For example, 1000 Japanese yen is output as 100000.

Tip

Use money filters to output a formatted amount.

Tip:

Use money filters to output a formatted amount.

Tip: Use <a href="/docs/api/liquid/filters/money-filters">money filters</a> to output a formatted amount.

Additional information captured with the cart.

To learn more about capturing cart notes, refer to the cart template.

Anchor to
original_total_priceoriginal_total_price

The total price of all of the items in the cart in the currency's subunit, before discounts have been applied.

The value is output in the customer's local (presentment) currency.

For currencies without subunits, such as JPY and KRW, tenths and hundredths of a unit are appended. For example, 1000 Japanese yen is output as 100000.

Tip

Use money filters to output a formatted amount.

Tip:

Use money filters to output a formatted amount.

Tip: Use <a href="/docs/api/liquid/filters/money-filters">money filters</a> to output a formatted amount.

Anchor to
requires_shippingrequires_shipping

Returns true if any of the products in the cart require shipping. Returns false if not.

Anchor to
taxes_includedtaxes_included

Returns true if taxes are included in the prices of products in the cart. Returns false if not.

This can be set in a store’s tax settings.

If the store includes or exclude tax based on the customer’s country, then the value reflects the tax requirements of the customer’s country.

Anchor to
total_discounttotal_discount

The total amount of all discounts (the amount saved) for the cart in the currency's subunit.

The value is output in the customer's local (presentment) currency.

For currencies without subunits, such as JPY and KRW, tenths and hundredths of a unit are appended. For example, 1000 Japanese yen is output as 100000.

Tip

Use money filters to output a formatted amount.

Tip:

Use money filters to output a formatted amount.

Tip: Use <a href="/docs/api/liquid/filters/money-filters">money filters</a> to output a formatted amount.

Anchor to
total_pricetotal_price

The total price of all of the items in the cart in the currency's subunit, after discounts have been applied.

The value is output in the customer's local (presentment) currency.

For currencies without subunits, such as JPY and KRW, tenths and hundredths of a unit are appended. For example, 1000 Japanese yen is output as 100000.

Tip

Use money filters to output a formatted amount.

Tip:

Use money filters to output a formatted amount.

Tip: Use <a href="/docs/api/liquid/filters/money-filters">money filters</a> to output a formatted amount.

Anchor to
total_weighttotal_weight

The total weight of all of the items in the cart in grams.

Tip

Use the weight_with_unit filter to format the weight in the store's format, or override the default unit.

Tip:

Use the weight_with_unit filter to format the weight in the store's format, or override the default unit.

Tip: Use the <a href="/docs/api/liquid/filters/weight_with_unit"><code><span class="PreventFireFoxApplyingGapToWBR">weight<wbr/>_with<wbr/>_unit</span></code></a> filter to format the weight in <a href="https://www.shopify.com/admin/settings/general">the store&#39;s format</a>, or override the default unit.

Deprecated Properties

Anchor to
discountsdiscounts
array of discount
Deprecated

The discounts applied to the cart.

Deprecated

Deprecated because not all discount types and details are available.

The cart.discounts property has been replaced by cart.discount_applications.

Deprecated:

Deprecated because not all discount types and details are available.

The cart.discounts property has been replaced by cart.discount_applications.

{
"attributes": {},
"cart_level_discount_applications": [],
"checkout_charge_amount": "380.25",
"currency": {},
"discount_applications": [],
"discounts": [],
"duties_included": false,
"empty?": false,
"item_count": 2,
"items": [],
"items_subtotal_price": "422.49",
"note": "Hello this is a note",
"original_total_price": "424.99",
"requires_shipping": true,
"taxes_included": false,
"total_discount": "44.74",
"total_price": "380.25",
"total_weight": 0
}
Example
{
 "attributes": {},
 "cart_level_discount_applications": [],
 "checkout_charge_amount": "380.25",
 "currency": {},
 "discount_applications": [],
 "discounts": [],
 "duties_included": false,
 "empty?": false,
 "item_count": 2,
 "items": [],
 "items_subtotal_price": "422.49",
 "note": "Hello this is a note",
 "original_total_price": "424.99",
 "requires_shipping": true,
 "taxes_included": false,
 "total_discount": "44.74",
 "total_price": "380.25",
 "total_weight": 0
}
Anchor to

Templates using cart

Theme architecturecart template
Theme architecture
cart template
Was this section helpful?