Cart Page

An important part of any online store is the shopping cart page. The cart page in LemonStand uses the shop:cart CMS action to load the cart's contents. The shop:cart CMS action also prepares cart related variables for use on your cart page, such as cart, items and itemCount. A typical cart page will include a list of items added to the cart, an estimated total and a checkout button.

Adding Related Product Upsells to the Cart

{% if product.upsells.count %}
    Upsales:
    {% for upsale in product.upsells %}
        <a class="button" href="#" data-ajax-handler="shop:cart" data-ajax-update="#mini-cart=shop-minicart, #cart-content=shop-cart-content" data-ajax-extra-fields="upsale_item='{{ upsale.id }}'">Add Upsale</a>
    {% endfor %}
{% endif %}
  • The image and product details available through upsale.product
  • The sale price available through upsale.price

Removing Cart Items

The cart page supports fields for removing cart items:

delete_item: Item Key
delete_items: [ array of Item Keys 

Pass these fields with a value equal to the cart item key to remove items from the cart.

Example - removing 1 cart item at a time:

{{ open_form({'class': 'custom'}) }}
  {% for item in items %}
    <a class="hide-for-small" href="/product/{{ item.product.url_name }}">
      <img src="{{ item.product.images.first.thumbnail(80, 80)|default('http://placehold.it/80x80') }}"/>
    </a>
    <h3><a href="/product/{{ item.product.url_name }}">
      {{ item.product.name }}
    </a></h3>
    <a href="#" 
      data-ajax-handler="shop:cart" 
      {# data-ajax-confirm="Do you really want to remove this item from the cart?" #}
      data-ajax-update="#cart-content=shop-cart-content, #mini-cart=shop-minicart"
      data-ajax-extra-fields="delete_item={{ item.key }}"
    >Remove</a>
  {% endfor %}
{{ close_form() }}

Example - removing all items in one click:

{{ open_form({'class': 'custom'}) }}
  {% for item in items %}
    <input type="" name="delete_items[]" value="{{ item.key }}">
  {% endfor %}
  <a href="#" 
    data-ajax-handler="shop:cart" 
    data-ajax-update="#cart-content=shop-cart-content, #mini-cart=shop-minicart"
  >Remove all items from the cart</a>
{{ close_form() }}


Variable Usage