# Cart object

# cart.attributes

Returns cart's additional information given by the user.


    <input type="text" name="attributes[tshirt-phrase]" />

Would be available at:


# cart.country

Returns the country associated to the cart.

# cart.has_free_shipping

Returns true if the cart has free shipping. Returns false if not.

# cart.id

Returns the unique id of the cart.

# cart.is_recurring

Returns true if the one or more items in the cart are subscriptions. Returns false if not.

# cart.items

Returns an array with all cart line items.

# cart.item_count

Returns the number of items in the cart.

# cart.just_added_item

Returns a cart line item if it was just added to the cart.

This is often used to call add-to-cart events in tracking scrips.


{% if cart.just_added_item %}
    fbq('track', 'AddToCart', {
        value: '{{ cart.just_added_item.variant.price | divided_by: 100 }}',
        currency: '{{ shop.currency }}',
        content_ids: ['{{ cart.just_added_item.variant.id }}'],
        content_type: 'product'
{% endif %}

# cart.original_total_price

Returns the total price of the cart without applied discounts.

# cart.points

Returns the customer points discounted to the total price of the cart.

# cart.tax_price

Returns the taxes applied to the cart.

# cart.tax_rate

Returns the tax rate applied to the cart.

# cart.total_discount

Returns the discounted value to the cart.

# cart.total_price

Returns the total price of the cart.

# cart.total_weight

Returns the total weight of the items in the cart.

# cart.voucher

Returns the voucher that is applied to the cart. Null if there isn't.

# cart.voucher_code

Returns the voucher code if a voucher is applied to the cart. "" if there isn't.