Display total items and total price in cart - WooCommerce
In some WooCommerce theme customizations, I want to display total items and total price in cart on some location like page header etc. So just use below code snippet in our template files.
<a class="cart-contents" href="<?php echo WC()->cart->get_cart_url(); ?>" title="<?php _e( 'View your shopping cart' ); ?>"><?php echo sprintf (_n( '%d item', '%d items', WC()->cart->cart_contents_count ), WC()->cart->cart_contents_count ); ?> - <?php echo WC()->cart->get_cart_total(); ?></a>
- Redirect single pages of post type in to post type archive page - WordPress
- Get details about available image sizes - WordPress
- Change shipping and billing address title - WooCommerce
- Add phone number to the output of the addresses on the "My Account" page - WooCommerce
- Conditional tags for order thank you page - WooCommerce
Your Questions / Comments
If you found this article interesting, found errors, or just want to discuss about them, please get in touch.