+813-444-3589+44 118 328 3220+49-231-976765-0 | Contact us

Cart

The Cart object contains various information about the articles in the cart. As the prices can contain VAT , the prices will tell you which values are what. Please make sure, that the cart values are correct, best to test it for various scenes. Also remark, that customers and sellers from USA and Canada will never have VAT calculated in the cart, this will happen in the actual checkout phase. Of course some other combinations of seller/buyer will also result in displaying no VAT (as there will be no tax on the purchase), e.g. somebody from New Zealand will purchase a product from Germany.

It contains the following fields:

Variable name Object Description Note
coupons List<Coupon> Coupons are special kinds of gift certificates, please have a look at the Coupon object for more information. This list contains all coupons in the cart. EF
coupon_error string If on last submission of a coupon an error has occurred, this field will contain a detailed error description. EF
currency string The currency specifier als 3-character string (EUR, USD, AUD, etc) for all products in the cart (only valid if there are articles in the cart). EF
currency_id int An internal identifier for the currency, e.g. EUR = 34, USD = 1 EF
item_count int  Number of items in the cart (number of different products, not the sum of all quantities of products in the cart).  
items List<Item The various items in the cart, each item can have quantity >= 1. For more information please have a look at the Item object.  
shipping_costs UserPrice   The shipping costs for the given products. For more information on the usage of the structure, please have a look at the UserPrice object. EF
total_item_count int This value contains the total number of products in the cart (including items with a quantity > 1). EF
total_price int This is the final total in the currency of the customer.  
total_price_net int This is the net total in the currency of the customer. EF
total_price_with_shipping_pricing List<UserPrice The list contains one UserPrice entry per used VAT percentage (some countries can have varying VAT percentages for different kind of products) of the total price with shipping costs included. Each UserPrice has information about net values, taxes, currency and gross value (if appropriate). EF
total_price_without_shipping int The final total, but without shipping costs included (in the currency of the customer). EF
total_price_without_shipping_pricing List<UserPrice The list contains one UserPrice entry per used VAT percentage (some countries have varying VAT percentages for different kind of products) of the total price with shipping costs excluded. Each UserPrice has information about net values, taxes, currency and gross value (if appropriate). EF
total_price_net_without_shipping int The net price without shipping costs in the customers currency. EF
total_weight int Returns the weight of the cart in shop defined units (e.g. gramm). Can be 0 if no items have any weight (e.g. only digital products).  
items_price_net int This is the sum of all items prices as net value (in the currency of the customer). EF
items_price_taxes int This is the sum of all items taxes (in the currency of the customer). EF

Example (full cart functionality):


{% for up in cart.total_price_with_shipping_pricing %}
  {% if up.vat_percentage > 0 %}
    {% assign item_with_vat = true %}
  {% endif %}
{% endfor %}
{% if cart.shipping_costs.vat_percentage > 0 %}
  {% assign item_with_vat = true %}
{% endif %}
{% if cart.item_count > 0 %}
  <form action="/cart" method="post" id="cartform">
  {% for item in cart.items %}
    <img src="/{{ item.product.featured_image.src | product_img_url: 'thumb' }}" alt="{{ item.title | escape }}" />
    <b>{{ item.title }}</b> - {{ item.variant.title }}
    {% for rebate in item.rebate %}
      <small>
        {% if forloop.first %}
          {% if rebate.from_items > 1 %}
            1-{{rebate.from_items | minus: 1 }} Normal price: {{item.variant.price | money}}/Per item
          {% endif %}
        {% endif %}
        {% assign percentleft = 100 | minus: rebate.percentage %}
        {% assign newprice = item.variant.price | times: percentleft |divided_by: 100 %}
        {% assign reduced = item.variant.price | times: rebate.percentage | divided_by: 100 %}
        {{rebate.from_items}}-{%if rebate.to_items > 0 %}{{rebate.to_items}}{%endif%} Rebate {{rebate.percentage}}% Special Offer: {{ newprice | money }}/Per Item - You save: {{ reduced | money }}/Per Item
      </small>
    {% endfor %}
    <input type="number" name="updates[{{item.variant.id}}]" id="updates_{{item.variant.id}}" value="{{ item.quantity }}" />
    <a href="/cart/change?line={{ forloop.index }}&quantity=0">X</a>
    {% if item_with_vat %}{{ item.variant.pricing.vat_percentage | times: 100 }}% {% endif %}
    {% if item.price > 0 or item.line_price <= 0 %}{{ item.price | money }}{% endif %}
    {{ item.line_price | money }}
  {% endfor %}
  {% for coup in cart.coupons %}
    {{ coup.code }}
    <a href="/cart/removecoupon?line={{ forloop.index }}">X</a>
    {% if coup.is_percentage %}
      {{ coup.percentage }}%
    {% else %}
      {{ coup.total_price | money }}
    {% endif %}
    {{ coup.total_price | money }}
  {% endfor %}
  {% if cart.shipping_costs.display_price > 0 %}
    Shipping Costs: {{ cart.shipping_costs.display_price | money }}
  {% endif %}
  {% if item_with_vat %}
    Total net: {{ cart.total_price_net | money }}
    {% for up in cart.total_price_with_shipping_pricing %}
      {% if up.includes_tax %}
        {{ customer_vat_name }} ({{ up.vat_percentage | times: 100 }}%):
      {% endif %}
      {{ up.taxes | money }}
    {% endfor %}
  {% endif %}
  <b>Final Total: {{ cart.total_price | money }}</b>
  <input type="submit" id="update-cart" name="update" value="Update" />
  </form>
{% else %}
  Your cart is empty. <a href="/">Continue shopping now!</a>.
{% endif %}
{% if cart.item_count > 0 %}
  <form action="/cart" method="post" >
    <h3>Gift certificates:</h3>
    {% if coupon_error %}
      <h3 style="color:#ff0000">{{coupon_error}}</h3>
    {%endif%}
    <input type="text" id="coupon" name="coupon" />
    <input type="submit" id="update" name="update" value="Use gift certificate" />
  </form>
{% endif %}
		

 

Output:


  <form action="/cart" method="post" id="cartform">
    <img src="/assets/image/L2Fzc2V0cy9pbWFnZS85NjQwLzQwOTYvaS5qcGc=/50/i.jpg" alt="Big Buck Bunny" />
    <b>Big Buck Bunny</b> - Rental (48 hours)
    <input type="number" name="updates[50151]" id="updates_50151" value="1" />
    <a href="/cart/change?line=1&amp;quantity=0">X</a>
    19%
    1,00 €
    1,00 €
    Total net: 0,84 €
        VAT (19%):
      0,16 €
  <b>Final Total: 1,00 €</b>
  <input type="submit" id="update-cart" name="update" value="Update" />
  </form>
  <form action="/cart" method="post" >
    <h3>Gift certificates:</h3>
      <h3 style="color:#ff0000"></h3>
    <input type="text" id="coupon" name="coupon" />
    <input type="submit" id="update" name="update" value="Use gift certificate" />
  </form>

Note: This object is exclusive to FlickRocket. If you are using a theme orginating from Shopify and want to use this functionality, you need to add this.