#1 Independent Seller of WooCommerce Plugins
Switch language
English

< Back to all articles

How to hide prices in WooCommerce

The idea of hiding product prices on your online store may seem counterintuitive for store owners whose ultimate goal is to sell them, but there can be numerous reasons behind this pricing strategy.

In this quick article, we’ll explore the benefits and scenarios in which this type of feature is introduced on WooCommerce products, and then we’ll see how to do it through code or by using a simple plugin.

Advantages of hiding prices in WooCommerce

There can be numerous advantages to hiding product prices, such as encouraging potential customers towards certain actions. Let’s look at some of them together:

  • Business necessity – Let’s start by saying that there are business models that must rely exclusively on the ability to hide prices and allow customers to request a quote. You can thus create an exclusive shopping experience and offer personalized quotes to various customers. This is particularly useful for certain services and B2B business models.
  • Encouraging registration – By showing prices only to registered users, you can increase the number of registrations, which will result in better understanding your customer base, including them in a newsletter, and creating a more loyal user base compared to occasional visitors.
  • Increases perceived value – A store with products whose prices are hidden can seem more exclusive, pushing customers to take that extra action to be part of the “club.” Similarly, it will be possible to propose slightly higher prices for the same reason.
  • Prices hidden from competition – In specific market niches, hindering competition from determining the cost of your products or services can be vital.
  • Other advantages may emerge depending on individual cases and different stores. But let’s see how you can introduce this functionality on WooCommerce.

Other advantages may emerge depending on individual cases and different online stores. But let’s see how you can introduce this.

How to hide prices in WooCommerce using code

There are basically two ways to hide prices in WooCommerce. You can do it via code or by using a special plugin.

We will look at both in these two parts of the guide, starting with code.

As attractive as this solution may be because it is free (the plugin we will see below also has a free version) and does not require the use of an additional tool, it also comes with risks and limitations. In fact, customizing its behavior requires programming skills that most WooCommerce users do not have.

In addition, going into the online store’s code can put you at risk of making mistakes and getting unintended results.

So what do you need to do to achieve this result? Our programmers have divided two types of code:

  • To hide the prices of all products on the online store.
  • To hide the price of some products.

In each case, these codes must be placed in the system file “Theme Functions”, which is the file functions.php.

To find it, go to your site’s menu and click on Appearance > Theme Editor. On the page that opens, click on the file (on the right) called “Theme Functions”.

Edit themes

Once you open this page, you can use the following code to easily hide prices of all products in the eCommerce store:

add_filter(‘woocommerce_product_get_price’, ‘__return_empty_string’);

If, instead, you want to hide the prices of some products, you will need to use this code:

add_filter( ‘woocommerce_product_get_price’, ‘hide_price_per_product’, 10, 2 );

function hide_price_per_product( $price, $product ) {

$products_where_hide_price = array( 1, 2, 3, 50, 100 ); // IDs of the products.

if ( $product instanceof WC_Product ) {
$product_id = $product->is_type( ‘variation’ ) ? $product->get_parent_id() : $product->get_id();
} else {
$product_id = $product;
}

if ( in_array( $product_id, $products_where_hide_price, true ) ) {
$price = ”;
}

return $price;
}

Where you’ll enter the product ID in the section:

$products_where_hide_price = array( 1, 2, 3, 50, 100 )

That’s it! However, if you’re not comfortable with the idea of directly editing your eCommerce store’s with the above code, here’s a plugin you can use to achieve the same result and more.

WooCommerce plugin to hide prices in WooCommerce

There are several solutions for hiding prices on your WooCommerce store, but few include all the features that allow the plugin to adapt to any circumstance. Like the ability to hide all the prices or only on specific products, show prices to certain user roles and hide them from others, hide the “Add to Cart” button, and add a contact form for customers.

A plugin that covers all this is WooCommerce Catalog Mode.

YITH WooCommerce Catalog Mode

This plugin comes in a free limited version and a premium version. It is ideal for those who want to try the various features (also accompanied by a top-notch support and service system), before purchasing.

In the next points of this guide, we will see how to use this plugin to achieve various results, including:

  • Hide price of all products
  • Hide price for specific products
  • Hide price until login

Let’s start with the first one.

How to hide the “Add to Cart” button

Before we go any further, if you were wondering how to hide the “Add to Cart” button from WooCommerce, you can do it with the Catalog Mode plugin. Hiding prices may make sense, but leaving the option to add an item to the cart may have the opposite effect.

In fact, once you have installed and activated the plugin, simply go to the WordPress side menu and click on YITH > Catalog Mode. This section is divided into several tabs, namely Settings, Exclusion List, Inquiry Form, Buttons & Labels, and Help.

In this particular case we are interested in the first tab. It is divided into two steps:

Step 1 – Set user rules. This section will come in handy at a later stage when you want to create rules that will apply only to a subset of users (for example, unregistered users).

Step 2 – Customize settings. This section defines the behavior of the plugin, including what to hide and what to show.

Catalog Mode options

One of the first things you see in Step 2 is the “Add to Cart” button. Here you can decide:

  • Whether to hide or show it.
  • Whether you want to hide it or show it on all pages (i.e., the product pages and the WooCommerce shop page) or just on one of them.
  • Whether to hide or show it for all products or only for certain products.

So, if you want to hide the “Add to Cart” button on all products and in the whole WooCommerce store, all you have to do is copy the settings we made, namely

Hide “Add to cart” in “All pages” for “All products”.

Let’s move on to price.

How to hide prices for products

To hide prices of all products, you need to scroll down the page you have just seen to the last entries:

Price settings

As you can see, there are two headings. The first one is “Price Settings in Catalog Mode”. To hide price on all products, you just have to select it:

“Hide price” for “All products”.

Once the product price is hidden, you can choose to leave the space where the price used to be empty or add a custom button. To do this, go between the tabs on the page and click on “Buttons and Labels” and then click on “Create a new button or label”.

You will be taken to an editor screen where you can create the button of your choice, perhaps one that redirects to a contact form or registration page.

How to hide price of specific products in WooCommerce.

If you only want to hide price of certain products, all you have to do is go back to the same setting and instead of selecting “All products”, select “Exclusion list products only”.

Exclusion list option

Since you will have to go back and add these products to the list, it is generally advisable to select this option:

  • Hide price for exclusion list products only – if the products from the hidden price are a small part compared to the total number of products contained in the online store. In this case, you should specify the products for which you want to hide price in the list.
  • Show price only for products in the list Exclusions – If the products from the hidden price are a large part compared to the total number of products contained in the online store. In this case, you will enter the products in the list that will show the price normally instead.

You only need to create the exclusion list at this point. To do this, go to the top tab “Exclusion List” and enter all the necessary products.

Add in exclusion list

To make your work easier, you can also select entire categories or tags.

How to hide price from logged out customers

Finally, if you only want to hide price from logged out users, perhaps to encourage them to register, all you have to do is go back to the “Settings” tab and edit the first item on the page:

User rules

As you can see, the very first item only asks for which users you want to enable catalog mode, whether for all users of the site or only for guest users (i.e. logged out users).

You only need to select this option to complete this function.

In this regard, we also recommend the WooCommerce Role Based Prices plugin, which allows you to show different prices depending on the user roles.

Conclusion

As we have seen, there are many reasons to hide product prices. Yet, even if you know how to hide price in WooCommerce and have code knowledge, this solution turns out to be very limiting and unprofessional.

For this reason, we recommend every WooCommerce shop that is interested in hiding prices, to use a dedicated plugin, especially if it comes with a free version that you can try without obligation to test the various features of the plugin for yourself.

Suggested readings

Join our newsletter to get all news directly in your e-mail!