Showing the Cart Quantity in Your Templates

It is very common for store themes to include a shopping cart icon along with the number of items in the shopping cart somewhere in the header, or in a sidebar. This snippet will show you how to do that.

The edd_get_checkout_uri() function will output the URL to the checkout page.

By adding the .edd-cart-quantity class to our quantity SPAN, we make sure that our quantity will get updated via ajax, for those sites that have ajax enabled for Easy Digital Downloads.

The result will look like this:

Cart (3)