Shopping Cart Buttons

It's common practise on eCommerce websites to display information about the contents of the current cart. This article will explain how to code a "current cart".

Current Cart: Number Of Items In Cart

The following snippet of code displays the number of items in the current user's cart. The snippet checks to determine whether there are any items in the cart, if there are no items present in the cart, "No Items in Cart" will be displayed.

Current Cart: Current Order Total

The following snippet of code displays the total of the current user's cart. The snippet checks to determine whether there are any items in the cart, if there are no items present in the cart, "No Items in Cart" will be displayed.