Do you want to hide the price for a certain product or multiple products in your online WooCommerce store? Doing so is actually quite easy. In this snippet we’ll show you how.

Use our plugin to hide prices
This article outlines a code snippet and requires knowledge of PHP to get it working. If you’re not wanting to use code to hide prices and would prefer a plugin solution instead, then checkout the Hide Prices plugin built by us. It allows you to hide prices for specific products and hide the add to cart button. It also allows you to replace the price with a simple text label or clickable button.
To get this working, what we need to do is add a filter that intercepts the rendering of the price for the product, check if the product we’re currently rendering to the page is one that we don’t want to display the price of, and if it is, return an empty price. Otherwise, we output the price as usual.
Snippet to hide the price for a specific WooCommerce product
<?php
/**
* Hide the price of a product or multiple products.
*
* @param string $price The existing price.
* @param object $product The product object.
* @return string
*/
function wpgeeks_hide_price_for_product( $price, $product ) {
// Populate this array with the ID's of product you want to hide the price of.
$products_to_hide = array( 1, 2, 3 );
if ( in_array( $product-&amp;gt;get_id(), $products_to_hide, true ) ) {
return '';
}
return $price;
}
add_filter( 'woocommerce_get_price_html', 'wpgeeks_hide_price_for_product' );
// Apply these filters to hide the price from the cart and checkout pages.
add_filter( 'woocommerce_cart_item_price', '__return_false' );
add_filter( 'woocommerce_cart_item_subtotal', '__return_false' );
You’ll notice the last two filters that we’ve added to the bottom of the snippet. These should be used if you want to hide the price from the cart and checkout page. Unfortunately, it doesn’t remove the entire line item but with a CSS rule or two, you can adjust the layout to suit your needs.
You may also be interested in changing the price display if a product is free. We hope you found this snippet useful, hit us up in the comments if you struggle with anything and we’ll try our best to help you out.