There are many plugins that allow you to setup special accounts for your wholesalers for example. Often times the user role feature of WordPress is used to identify users within a specific group. In this post I’ll show some examples of how you can display/hide prices for specific user groups, including only for specific products / categories.

The snippets in this post will only be for hiding prices, it will still continue users to add products to the cart.

Hiding all the prices

Lets start with a simple script first. This is a example of how you can hide all the prices no matter who is viewing.

I’ve made it so that it does still show prices on the admin, but you can easily comment that line out if you also want to hide prices there.

This code snippet hides all the prices on the product / archive pages, but not on the cart/checkout pages (or the cart widget). The following code also removes the cart item price / subtotal and the same for the checkout.

After using this code snippet it will leave the headings in the table. Unfortunately these cannot be removed with a code snippet, but there are two alternatives.

  1. By modifying the WooCommerce template files you can remove the columns from the totals table. The totals table is located in the cart/cart.php template file.
  2. You can hide them with CSS. A technical user could still uncover the product prices through, so depending on how important it is, this may or may not fit your requirements.

Here’s a CSS snippet that hides the prices on the items on the cart/checkout table and the cart widget:

/* Cart widget */
.woocommerce-mini-cart__total {
	display: none;

/* Cart */
.product-price, .product-subtotal {
	display: none !important;

/* Checkout */
.product-total *, th.product-total {
	display: none;

Again, this is not a foolproof solution.

Hiding prices for specific user roles

In the below code snippet it will hide the prices for all users with the ‘wholesale’ user role. In the sample code I’ve added multiple rows to show how you can can hide prices for different user roles. Adding more options to it is possible by following the shown format.

Hiding prices for guest users

To only hide it for guest users you can use the following simplified version;

Hiding prices in specific categories

With this version of the code snippet you can target specific categories to hide the prices for.

You can either modify the set categories to the slug of ID of the category.

If wanted you can also combine the snippets to only hide the prices in specific categories for a guest user;

Hiding prices for specific products

Here’s one last version where it only hides the prices for specific products based on the product ID.


Hope you’ve found this post helpful!

Jeroen Sormani

I'm a professional WordPress plugin developer on a mission to create the best plugins for my clients. I'm specialised in developing general WordPress, WooCommerce and Easy Digital Downloads plugins.

Interested in talking about a WordPress project? Get in touch!

Follow me on Twitter

98 thoughts on “Hiding product prices in WooCommerce

Neeraj April 4, 2021 at 11:20 pm

Any solution to hide all the price from the custom post type

Jeroen Sormani April 5, 2021 at 10:01 am

Not sure what CPT you’re referring to; you can try to add a `get_post_type()` or `is_singular(”)` check to the snippet.

teo April 6, 2021 at 1:34 pm

Hi, where shoud I paste “Hiding prices for specific products” code?
thanks a lot!

Jeroen Sormani April 6, 2021 at 2:38 pm

Hi Teo,

Code snippets can be added to your site as described here;


Alex April 17, 2021 at 10:51 pm

Thanks, this helped a lot!

Leandro March 28, 2022 at 3:12 am

Hi Jeroen. Is there a way to hide the price for specific products when a specific plugin is active on the product page?

Jeroen Sormani March 28, 2022 at 11:25 am

Hi Leandro,

It is possible to customize the script further to target when a specific plugin is active. Targeting specific products can be done with the last snippet in the post.
For checking if a plugin is active you can use something like is_plugin_active( 'woocommerce/woocommerce.php' )


David Torrijos March 30, 2022 at 1:04 pm

Hi it is posible to hide the price of products with the same attribute?

Thx so much!

Jeroen Sormani March 31, 2022 at 2:23 pm

Hi David,

It is possible to target products based on attribute, though I don’t have something readily available for this. Feel free to reach out through the contact page if you’d like my assistance in creating something for this.


Benjamin Mitas April 25, 2022 at 12:11 pm

Hi, i wanted to hide the price for a specific categorie.
I placed my category-ID in line 11 like “…get_id(my category -ID)” and deleted line 5 since i want to see it as admin like every customer.
In this scenario my prices are hidden in all categories – where is my mistake?

Jeroen Sormani April 25, 2022 at 1:49 pm

Hi Benjamin,

Line 11 shouldn’t be modified. Instead set your category slugs in the $hide_for_categories variable to change for which categories it should apply.


Paulinho April 30, 2022 at 12:04 am

Hi Jeroen,
Is there a snippet for hiding the price and add to cart from the archive (shop) page only? leaving the product page untouched. I want to have just the products and their title on the shop page.

Thank you!

Jeroen Sormani May 4, 2022 at 3:58 pm


It is not something covered in this blog post, but you should be able to add a small check for is_archive( 'product' ); for example to check if its an archive page.


Kins June 16, 2022 at 12:20 pm

Is there anyway to hide the prices using shortcode?

Also is it possible to hide prices without affecting single product page?

Jeroen Sormani June 17, 2022 at 10:45 am

Hi Kins,

It won’t be possible to hide product prices with a shortcode..

If you’d like to only hide the prices on the overview pages you can add a additional check such as the is_archive( 'product' ) for example.


ali June 17, 2022 at 7:45 am

How can i hide cart total section, i want to make only catalog site without eCommerce functionality.

Jeroen Sormani June 17, 2022 at 10:55 am

Hi Ali,

This blog is only focussed on hiding individual product prices, not to turn off the eComm functionality (it would require more than hiding the totals).


Tony August 19, 2022 at 8:25 pm

Hello Jeroen, i am trying to use the ‘hide prices for categories’ snippets, but i don’t know the values to change for it to work. If you can help tell me what to input to make it work, that will help me . Thanks

Jeroen Sormani August 19, 2022 at 10:42 pm

Hi Tony,

You’d want to change the slugs of the categories in the $hide_for_categories variable. The values ‘single’ and ‘album’ are used for the example, change these to the categories applicable for your setup.


Tony August 20, 2022 at 5:51 pm

Hello again Jeroen, Thank you so much for earlier. The categories worked but now can you help tell me what i should replace in the single products just like in the categories. Thank you and i am waiting to hear your response

Kassy August 29, 2022 at 8:03 pm

HI Jeroen, how do i edit the snippets and make the price show up in the cart page

Jeroen Sormani August 30, 2022 at 10:54 am

Hi Kassy,

The first snippet on this page should work for you, this hides all the prices, but it does not hide the ‘line prices’ in the cart/checkout page(s).


John August 30, 2022 at 5:17 pm

Good Day Jeroen, Glad i found this blog

Patterning to kassy’s question about not hiding the prices on the cart/checkout page, will the first snippet that you pointed out to Kassy still work if i want to only hide prices for certain categories or is there another specific snippet that works just for hiding prices in a particular category and not hiding them in the cart/checkout page.

Thank you and i am waiting to hear from you kind sir

Jeroen Sormani September 1, 2022 at 2:00 pm

Hi John,

You’d want to use the other snippet on this page. You can remove the last 2 lines to not hide the prices on the cart/checkout.


John September 4, 2022 at 3:11 am

Thank You for replying Jeroen, but please with snippet am i removing the last 2 lines in. Is it the snippet for the categories or what.

Teo November 9, 2022 at 4:54 pm

Hi Jeroen! One quick question: is there a way to hide all products where price is under certain value? For example, hide all products where price is < 100$.

Thank you!

Jeroen Sormani November 10, 2022 at 10:00 am

Hi Teo,

Are you looking to hide products or product prices under $100?


Teo November 10, 2022 at 11:35 am

Hi Jeroen,

I’m looking to hide products which have prices under $100.



Teo November 10, 2022 at 12:05 pm

I’m sorry! I need to hide products which have prices over $100 :).

Jeroen Sormani November 11, 2022 at 10:24 am

Hi Teo,

Unfortunately the snippets in this post are not suitable to hide products completely. A different customization would be needed for this. Feel free to reach out through my contact form if you need help creating that.


david December 11, 2022 at 2:48 am

Hi Jeroen – This is great! Is there a way to modify this such that rather than hiding based on product ID it hides based on a product tag?

Jeroen Sormani December 11, 2022 at 10:16 pm

Hi David,

You can use the product category snippet for that, just change the ‘product_cat’ to ‘product_tag’ in there and it should work.


david December 13, 2022 at 1:05 am

Thanks Jeroen – that worked perfect! But it seems that with variable products when the page first loads the price is hidden, yet as soon as you select one of the options, the price is displayed again. Any way to make this work on variable products after selecting an option?

Jeroen Sormani December 13, 2022 at 7:32 am

Hi David,

Unfortunately I don’t have a solution for that from the top of my head. The code may need some further customzing/addition added to it for that scenario.


mel b August 19, 2023 at 7:13 pm

how do you hide pricing in recently viewed products

i use legacy widget > recently viewed products list

Leave a Reply