... Skip to main content
Woocommerce

WooCommerce: Variable Product “Cumulative” Stock Quantity

By May 28, 2025No Comments2 min read

When a variable product stock quantity is managed at variation level, the stock status is either “In stock” or “Out of stock” without any mention of the quantity.

It would be cool, however, and in certain cases only, to show the total stock quantity for all single variations. If variation Red has 3 in stock, variation Blue has 7 in stock and variation Green has 10 in stock, I’d like to set the “parent product” stock quantity to 3 + 7 + 10 = 20.

So, how do we do that?

PHP Snippet: Variable Product Stock Quantity = Sum of All Single Variations’ Stock Quantity

Custom Plugin:

If you want to display your variations as a table then you can do it Easily to using the Variation Monster  plugin. Which have free and pro version also. You will get color and image swatches, variation tables, quick cart carousels, tooltips, quick view popups, custom discount badges, and gallery layouts  Features which will give you more flexibility to customize your variable products without no coding experience.

Plugin free: https://wordpress.org/plugins/variation-monster/  

Get Pro: https://www.wooxperto.com/variation-monster/#pricing

Where to add custom code?

You should place custom PHP in functions.php and custom CSS in style.css of your child theme.

This code still works, unless you report otherwise. To exclude conflicts, temporarily switch to the Storefront theme, disable all plugins except WooCommerce, and test the snippet again.

Leave a Reply