In WooCommerce, I have a custom meta field "Brand" on my products, and each product is assigned with one of the Brands.
Now I want to get total stock for each brand from all products and I have only variable products, so I think I may have to query through Post type product_variation
.
I don't want to run a WordPress meta query for this as I have a lot Brands and I do not want to run too many loops.
As I do not have SQL skills, I am not able to implement this correctly and
I will really appreciate your help.