A cart loop lets you loop through all the products added to a cart. This is good for a view cart page or a js dropdown for your cart
Example:
{% loop cart %} <div class="item-image"> <a href="{cart.product_url}">{cart.product_image_compact}</a> </div> <div class="item-left"> <p class="product-title"><a href="{cart.product_url}">{cart.product_name} {% if cart.product_variation != "" %}({cart.product_variation}){% endif %}</a></p> <p>{cart.product_sku}</p> <p>{cart.attr_spice_level}</p> <p>{cart.product_delete}</p> <p class="price">{cart.product_price}</p> <p class="quantity">{cart.product_quantity_html}</p> </div> {% endloop cart %}
The following output tags are available:
Output Tag | Description |
{product_name} | Product Display Name |
{product_price} | Product SKU Price (not product price) |
{product_description_7} | First 7 words of product description |
{product_description_10} | First 10 words of product description |
{product_description_15} | First 15 words of product description |
{product_description_25} | First 25 words of product description |
{product_description_50} | First 50 words of product description |
{product_description_75} | First 75 words of product description |
{product_description_100} | First 100 words of product description |
{product_description_200} | First 200 words of product description |
{product_description} | First 200 words of product description |
{product_url} | Product URL |
{product_id} | Product ID |
{product_sku} | SKU |
{product_quantity} | Product Quantity |
{product_quantity_html} | HTML input field for changing quantity |
{product_delete_url} | URL for removing a product |
{product_delete} | AHREF for removing a product |
{product_discount_applied} | Returns a 0 if no discount was applied to price. Returns a 1 if item qualified for a discount. (0 = false, 1 = true) This flag does not register site wide customer type discount. |
{product_bulk_pricing} | Returns a 0 if bulk pricing did not apply. Returns a 1 if item qualified for bulk pricing. (0 = false, 1 = true) |
{product_variation} | Comma delimited variations |
{product_image_[size]} | This will call the default image for the product. See the section about image sizes to enter for the word [size] |
attribute slug | All product attribute slugs that have been flagged to show externally |
attribute slug | All sku attribute slugs that have been flagged to show externally |
Loop Conditionals | Click here to learn more about loop conditionals. |
This loop requires pagination. Please see the section about pagination on how to implement and what variables are accessible using pagination.
NOTE: Some useful functions outside the loop are {start_checkout_html}, {start_checkout_url}, {cart_total}, {cart_num_items}