Title: Exclude single category/product from function
Last modified: August 30, 2016

---

# Exclude single category/product from function

 *  [littlebizonline](https://wordpress.org/support/users/littlebizonline/)
 * (@littlebizonline)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/exclude-single-categoryproduct-from-function/)
 * Hi,
 * I have added the below code to functions.php of my child theme in order to show
   quantity count for products within the category pages:
 *     ```
       function shop_inventory(){
       	global $product;
               {echo 'Available: '.number_format($product->stock,0,'','');}
       };
       add_action( 'woocommerce_after_shop_loop_item_title', 'shop_inventory' );
       ```
   
 * However, I would like to exclude one category from this action (which only has
   three products, so could be done on a product level if it is easier).
    I have
   tried to display: none but there is no selector with the above for me to do this.
 * Thank you!
 * [https://wordpress.org/plugins/woocommerce/](https://wordpress.org/plugins/woocommerce/)

The topic ‘Exclude single category/product from function’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

## Tags

 * [category page](https://wordpress.org/support/topic-tag/category-page/)
 * [exclude](https://wordpress.org/support/topic-tag/exclude/)
 * [product-quantity](https://wordpress.org/support/topic-tag/product-quantity/)

 * 0 replies
 * 1 participant
 * Last reply from: [littlebizonline](https://wordpress.org/support/users/littlebizonline/)
 * Last activity: [10 years, 10 months ago](https://wordpress.org/support/topic/exclude-single-categoryproduct-from-function/)
 * Status: not resolved