Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // exclude stock amount for one category
- // code goes in functions.php for your child theme
- function shop_inventory() {
- global $product;
- $terms = get_the_terms( $product->post->ID, 'product_cat' );
- $show = true;
- foreach ($terms as $term) {
- if ($term->term_id == 12) { // where 12 is your cat id for service
- $show = false;
- }
- }
- if ($show) {
- echo 'Available: '.number_format($product->stock,0,'','');
- }
- }
- add_action( 'woocommerce_after_shop_loop_item_title', 'shop_inventory' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement