This little snippet will allow you to hide product prices in selected categories. Simply replace the slugs in the code below.
// Specific product category archive pages add_action( 'woocommerce_after_shop_loop_item_title', 'hide_loop_product_prices', 1 ); function hide_loop_product_prices(){ global $product; if( is_product_category('PUT YOUR CATEGORY SLUG HERE') ): // Hide prices remove_action('woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 ); // Hide add-to-cart button remove_action('woocommerce_after_shop_loop_item','woocommerce_template_loop_add_to_cart', 30 ); endif; } // Single product pages add_action( 'woocommerce_single_product_summary', 'hide_single_product_prices', 1 ); function hide_single_product_prices(){ global $product; if( has_term( 'PUT YOUR CATEGORY SLUG HERE', 'product_cat', $product->get_id() ) ): // Hide prices remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 ); // Hide add-to-cart button, quantity buttons (and attributes dorpdowns for variable products) if( ! $product->is_type('variable') ){ remove_action('woocommerce_single_product_summary','woocommerce_template_single_add_to_cart', 30 ); } else { remove_action( 'woocommerce_single_variation', 'woocommerce_single_variation_add_to_cart_button', 20 ); } endif; }
gfdfgh
Giles Martin
October 5, 2018Worked like a charm thank you 🙂
Mieke
May 4, 2019Thanks! This one works for me!
mohan mandal
September 11, 2020want to hide variable product price in product page only not in shop page and home page
Stefano
March 1, 2021Hi, how to fix for multiple categories?