• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2893

Original Genesis & WooCommerce Tutorials & 6000+ Guaranteed Code

Snippets

  • Checkout

Get Total Quantity & Subtotal for Products in Specific Category WooCommerce

$75.00

Demo Video
Category: WooCommerce Tags: get_cart, get_price, get_regular_price, has_term, wc_price, wc-cart-fragments, woocommerce_add_to_cart_fragments
  • Description

This code displays the total quantity of products in 1 or more set categories along with the total subtotal price without adding products in other categories.

The code enables you to :

  • Use a custom function to modify get_cart_total.
  • Use a custom function to modify the cart quantity get_cart_contents_count.
  • Includes child/sub terms.
  • Works with any taxonomy terms.
  • Dynamically update the cart subtotals using ajax without the need to reload any pages.
  • Add the cart content subtotals to your nav menu.

Both the total quantity and total price for products in set categories are updated dynamically on the cart page. This does not affect the subtotal on the cart page or on the checkout page as seen in the demo video.

Display Total Quantity & Price for Products in Specific Category WooCommerce

Video Demo

Shows products from multiple categories added to the cart but only displaying the cart item count and sum of subtotals for products in a specific category or taxonomy term.

Installation

There’s 2 steps :

Step 1 – Swap out your category, tag or other taxonomy term slug on lines 25 and 58 of the plugin.php file.

Step 2 – Install the download folder as a new plugin or copy & paste the PHP code to the end of your child themes functions.php file or custom functionality plugin.

Primary Sidebar

Guaranteed code

Written by Brad Dalton specialist for WooCommerce. Read More…

Advertise · WPEngine · Genesis · Log in

  • Code Snippets
  • Tutorials
  • Videos
  • Tags
  • Account
  • Checkout
  • Cart
  • Hire Me
 

Loading Comments...
 

You must be logged in to post a comment.