Show cart contents / total

Add this code to your child theme’s functions.php file or via a plugin that allows custom functions to be added, such as the Code snippets plugin. Avoid adding custom code directly to your parent theme’s functions.php file, as this will be wiped entirely when you update the theme.

To display the cart contents and total in your template, use something like:

https://gist.github.com/woogists/9a16fd2d0c982e780a5de89c30cbbd25

To ajaxify your cart viewer so it updates when an item is added (via ajax) use:

https://gist.github.com/woogists/c0a86397015b88f4ca722782a724ff6c


14 responses to “Show cart contents / total”

  1. […] And that’s it! These two small snippets are all you need to add a quantity input to archived product pages and maintain ajax functionality. If you’d like a dynamic cart on your page that updates when you add products via ajax, WooCommerce has already got you covered here: http://docs.woo.com/document/show-cart-contents-total/. […]

  2. […] Normally — and if you use one of the woo themes — this shows up in the menu navigation bar. However, I am using an almost completely blank theme, and I do not know how I can get the item / price total information and display it in html. Their documentation gives this snippet: http://docs.woo.com/document/show-cart-contents-total/ […]

  3. […] I am using woocommerce and wordpress for an e-commerce website. I want to be able to display the number of items and total price in a user's cart anywhere on the page. Normally — and if you use one of the woo themes — this shows up in the menu navigation bar. However, I am using an almost completely blank theme, and I do not know how I can get the item / price total information and display it in html. Their documentation gives this snippet: http://docs.woo.com/document/show-cart-contents-total/ […]

  4. […] in most cases — and if you use probably the most woo issues — this shows up within the menu navigation bar. then again, i’m the usage of a nearly completely blank theme, and i have no idea how i can get the article / worth complete knowledge and show it in html. Their documentation offers this snippet: http://docs.woo.com/report/exhibit-cart-contents-complete/ […]

  5. […] are forever in your debt Woothemes for this […]

  6. […] are forever in your debt Woothemes for this […]

  7. […] I am using the snippet from the woothemes that can be found here. […]

  8. […] I am using the snippet from the woothemes that can be found here. […]

  9. […] are forever in your debt Woothemes for this […]

  10. […] Show cart contents / total. WooCommerce Multilingual – E-Commerce Sites in Several Languages. WooCommerce Multilingual makes it easy to run multilingual e-commerce sites with WooCommerce and WPML. […]

  11. […] I am using the snippet from the woothemes that can be found here. […]

  12. […] As an example, look at our blog post on making a dynamic cart, and WooThemes’ documentation on cache-friendly cart totals. […]

  13. […] I am using wordpress 4.5.2 and WooCommerce 2.5.5 Using the following link I have added fixed custom fee to WooCommerce cart total : http://www.remicorson.com/add-custom-fee-to-woocommerce-cart-dynamically/ I have displayed one drop-down list on the frontend. It contains different values like 5,10,15,etc.. I want to add the custom fee to WooCommerce cart total which is selected from this drop-down. It means custom fee value will be dynamic. Using the following link I have displayed cart content in the sidebar but, custom fee value is not added to this total. https://docs.woo.com/document/show-cart-contents-total/ […]

Leave a Reply

Your email address will not be published. Required fields are marked *