This function checks if all products belonging to a product category or custom taxonomy is out of stock.
This function uses Transients API to cache 1 hour the result for avoiding large amount of querys.
<?php wc_check_is_out_stock_category( $term_id, $taxonomy ) ?>
$term_id
(string) (required) Category id or term id to check
Default: false
$taxonomy
(string) (optional) Category id or term id to check
Default: 'product_cat' (WooCommerce Product Category)
(boolean) True on success, false on failure.
Hi Jartes!
'title', 'order' => 'ASC', 'hide_empty' => '1', ``` ); $product_categories = get_terms( 'product_brand', $args ); $count = count($product_categories); if ( $count > 0 ){ foreach ( $product_categories as $product_category ) { ``` echo '' . $product_category->name . 'I don't know if I can ask for your help ...
I'm trying to have a list of products brands containing in stock products (product_brand instead of product_cat)
Can I use your code? I yes, how can I implement it?
Thank you and best regards :-)
'; } ``` } ?>