Appearance
Cart tag
The cart tag is responsible for creating a cart overview.
The tag
{exp:reinos_store:cart}
Tag Parameters
Below are the Tag Parameters. Those parameters can be used in the tag described above
return_url
The return url, default to the current url
return_url=""
form_class
Set the form class
form_class=""
form_id
Set the form id
form_id=""
prefix
Set a prefix for your variables
prefix="cart:"
can_update
Mark the cart so it can be updated. We add a <form/>
tag in the html.
can_update="yes"
Tag Variable
Below are the Tag Variables. Those Variables can be used in the tag described above
cart:no_items
Check if there are no_items
{if cart:no_items}...{/if}
cart:items
Loop over the items in the cart
{cart:items}
{cart:name}
{cart:price}
{cart:price:formatted}
{cart:old_price} // when dealing with a sale price, this is the original_price
{cart:old_price:formatted} // when dealing with a sale price, this is the original_price
{cart:price_plus_tax}
{cart:price_plus_tax:formatted}
{cart:old_price_plus_tax} // when dealing with a sale price, this is the original_price
{cart:old_price_plus_tax:formatted} // when dealing with a sale price, this is the original_price
{cart:qty}
{cart:sku}
{cart:entry_id}
{cart:disable_shipping}
{cart:price_total}
{cart:price_total:formatted}
{cart:old_price_total} // when dealing with a sale price, this is the original_price
{cart:old_price_total:formatted} // when dealing with a sale price, this is the original_price
{cart:price_total_plus_tax}
{cart:price_total_plus_tax:formatted}
{cart:old_price_total_plus_tax} // when dealing with a sale price, this is the original_price
{cart:old_price_total_plus_tax:formatted} // when dealing with a sale price, this is the original_price
{cart:custom_fields}<strong>{custom_fields:label}:</strong> {custom_fields:value}{/cart:custom_fields}
{cart:on_sale} // bool if the product is on sale
{cart:note}
{cart:parent_order_item_id}
{/cart:items}
cart:total_items
The total number of different products in the cart
{cart:total_items}
cart:total_items_qty
The total qty of all items in the cart
{cart:total_items_qty}
cart:subtotal_before_discount
This is the subtotal before any discount is applied.
{cart:subtotal_before_discount}
{cart:subtotal_before_discount:formatted}
cart:subtotal_before_discount_plus_tax
This is the subtotal before any discount is applied.
{cart:subtotal_before_discount_plus_tax}
{cart:subtotal_before_discount_plus_tax:formatted}
cart:subtotal
{cart:subtotal}
{cart:subtotal:formatted}
cart:subtotal_plus_tax
{cart:subtotal_plus_tax}
{cart:subtotal_plus_tax:formatted}
cart:discount
To use the coupon code, simply add the field <input type="text" name="coupon_code" value="{cart:coupon_code}"/>
. (see the examples for details)
{cart:discount}
{cart:discount:formatted}
cart:total
{cart:total}
{cart:total:formatted}
cart:total_plus_tax
{cart:total_plus_tax}
{cart:total_plus_tax:formatted}
cart:tax
{cart:tax}
{cart:tax:formatted}
cart:shipping
{cart:shipping}
{cart:shipping:formatted}
cart:shipping_plus_tax
{cart:shipping_plus_tax}
{cart:shipping_plus_tax:formatted}
cart:entry_ids
Hold all entry_ids as a pipeline delimited string
{cart:entry_ids}
Example
{exp:reinos_store:cart prefix="cart:" can_update="yes" return_url="store/cart"}
<h1 class="font-bold mt-5 text-2xl">Your cart</h1>
{if cart:no_items}
<p>No cart items</p>
{if:else}
<p class="mb-10 text-italic">({cart:total_items} products in cart and {cart:total_items_qty} items in cart)</p>
<table class="w-full table-auto mt-4 mb-4">
<thead class="border-b-2">
<tr>
<th align="left">Name</th>
<th align="left">Qty</th>
<th align="left">Price</th>
<th align="left">Subtotal</th>
<th />
</tr>
</thead>
<tbody>
{cart:items}
{exp:channel:entries entry_id="{cart:entry_id}" dynamic="no"}
<tr class="border-b">
<td>
<div class="py-3">
<a href="{page_uri}">{title}</a>
{if cart:sku != ''}<small>sku: {cart:sku}</small>{/if}
{cart:custom_fields}<br><strong>{custom_fields:label}:</strong> {custom_fields:value}{/cart:custom_fields}
</div>
</td>
<td><input class="border p-1 rounded" type="number" value="{cart:qty}" name="qty[{cart:id}]"></td>
<td>
{cart:price_plus_tax:formatted}
{if cart:on_sale} <strike>{cart:old_price_plus_tax:formatted}</strike>{/if}
</td>
<td>
{cart:price_total_plus_tax:formatted}
{if cart:on_sale} <strike>{cart:old_price_total_plus_tax:formatted}</strike>{/if}
</td>
<td align="right">
{exp:reinos_store:delete_cart_item cart_item_id="{cart:id}" return_url="/store"}
<a class="button" href="{remove_cart_item_url}">Remove</a>
{/exp:reinos_store:delete_cart_item}
</td>
</tr>
{/exp:channel:entries}
{/cart:items}
</tbody>
</table>
<div class="w-1/2 flex flex-col ml-auto">
<h3 class="text-lg font-medium mt-5">Coupon code</h3>
<div class="flex gap-x-1 mb-5">
<input class="w-full border p-1 rounded" type="text" name="coupon_code" value="{cart:coupon_code}"/>
<input type="submit" name="update" value="Apply" class="button"/>
</div>
<table>
<tbody>
<tr>
<td align="right"><strong>Subtotal</strong></td>
<td align="right">{cart:subtotal_plus_tax:formatted}</td>
</tr>
{if cart:discount > 0}
<tr>
<td align="right"><strong>Discount</strong></td>
<td align="right">{cart:discount:formatted}</td>
</tr>
{/if}
{if cart:tax > 0}
<tr>
<td align="right"><strong>TAX</strong></td>
<td align="right">{cart:tax:formatted}</td>
</tr>
{/if}
{if cart:shipping_plus_tax > 0}
<tr>
<td align="right"><strong>Shipping</strong></td>
<td align="right">{cart:shipping_plus_tax:formatted}</td>
</tr>
{/if}
<tr>
<td align="right"><strong>Total excl</strong></td>
<td align="right">{cart:total:formatted}</td>
</tr>
<tr>
<td align="right"><strong>Total</strong></td>
<td align="right">{cart:total_plus_tax:formatted}</td>
</tr>
</tbody>
</table>
</div>
<input type="submit" name="update" value="Update" class="button"/>
<input type="submit" name="clear" value="Clear cart" class="button"/>
<a class="button" href="/index.php/store/checkout">Checkout</a>
{/if}
{/exp:reinos_store:cart}