Woocommerce – Display CATEGORY stock quantity per variation

Question

I’ve been trying to get a variation stock quantity list to display in a CATEGORY page. I know I can get variation stock quantity for a given product, but I’ve never found how to sum all variation stock quantity of all products in a CATEGORY.

For example, for a category named “SNEAKERS”, I have 2 products:

Sneaker A

  • Size 7 = 2 items
  • Size 8 = 3 items
  • Size 9 = 0 items
  • Size 10 = 1 item

Sneaker B

  • Size 7 = 0 items
  • Size 8 = 1 items
  • Size 9 = 0 items
  • Size 10 = 5 item

The variation stock quantity list in the CATEGORY page would be:

  • Size 7 = 2 items total
  • Size 8 = 4 items total
  • Size 9 = 0 items total
  • Size 10 = 6 items total

Is it possible or I’m crazy? Or I can only get variation stock quantity for a single product?

FYI… In fact, this is not meant to be a list, this is meant to be a FILTER! I would like to show sizes available and hide sizes without stock.

Thanks in advance!

0
hormigaz 2 years 2020-01-07T08:41:02-05:00 0 Answers 80 views 0

Leave an answer

Browse
Browse