Display Cart Information within Catalog
Display Cart Information within Catalog
The following code snippets will show you how to:
- Display the cart item count
- Display the number of units (sum of the item quantities)
- Display the cart subtotal
- Display a greet to the logged in customer
Cart Item Count
$cart.getItemCount()
Display the number of units
#set ($units = 0) #foreach ($cartItem in $cart.getItems()) #set ($units = $units + $cartItem.getQuantity()) #end You have $units unit(s) in your cart.
Cart Subtotal
$cart.getSubTotal()
Greet Logged in Customer
#if ($cart.getCustomerProfile()) Welcome back $cart.getCustomerProfile().getFirstName() #end