WooCommerce has no setting to hide prices from visitors or to give wholesale customers their own prices: every price is the same for everybody. To show “Log in to see prices” you need a small code snippet (or a plugin) that replaces the price and blocks the cart for guests. To give logged-in trade customers a different price, you need a wholesale plugin that adds a role or group and a second price on each product.
Why it happens
- Core WooCommerce has one price per product. A regular price and a sale price, both public. There is no price per user role, per customer or per quantity.
- The “Customer” role is the only one. Everybody who registers gets the same role, so WooCommerce can’t tell a shop from a consumer.
- Hiding the price on screen is not the same as hiding it. Most snippets change only the visible price. The price is still in the product’s structured data (the JSON-LD that Google reads), in the Store API (
/wp-json/wc/store/v1/products) and in your Google feed, if you have one. - Variable products have two ways in. Each variation has its own price and its own “purchasable” check. Snippets written for simple products often leave the variation price and the add-to-cart button working.
- Page cache. If your cache saved a page while it still showed prices, guests keep seeing that copy until you clear it.
How to check it yourself
- Open your store in a private window, logged out. Look at the shop page, a simple product and a variable product. Choose a variation: does a price appear?
- Try to buy anyway. Add
?add-to-cart=123(with a real product ID) to your shop URL. If the product lands in the cart, guests can still order. - Look at the structured data. Open a product page, view the source (Ctrl+U) and search for
"price". If it’s there, Google and AI crawlers can read it. - Look at the Store API. Open
https://yourstore.com/wp-json/wc/store/v1/products. Thepricesfield of each product is public unless a plugin removes it. - Log in as a test trade customer and check that the price you expect shows on the product, in the cart and in the order email.
How to fix it
To hide prices from guests without a plugin, add this to your child theme’s functions.php or a code snippets plugin (make a backup first and test it on a staging copy):
// Guests see a link instead of the price.
add_filter( 'woocommerce_get_price_html', function ( $price, $product ) {
if ( is_user_logged_in() ) {
return $price;
}
$url = wc_get_page_permalink( 'myaccount' );
return '<a href="' . esc_url( $url ) . '">Log in to see prices</a>';
}, 10, 2 );
// Guests can't add anything to the cart (simple and variable products).
add_filter( 'woocommerce_is_purchasable', function ( $ok ) {
return is_user_logged_in() ? $ok : false;
} );
add_filter( 'woocommerce_variation_is_purchasable', function ( $ok ) {
return is_user_logged_in() ? $ok : false;
} );
// Leave the price out of the structured data for guests.
add_filter( 'woocommerce_structured_data_product', function ( $markup ) {
if ( ! is_user_logged_in() ) {
unset( $markup['offers'] );
}
return $markup;
} );
Then clear your page cache (and Cloudflare’s, if you use it) and repeat the checks above. Two things this snippet doesn’t do: it doesn’t remove the raw prices from the Store API, and without offers your products stop qualifying for price rich results in Google. If your theme or page builder draws prices with its own widget, it may skip the filter; check those pages too.
If you want the whole store closed to guests, WooCommerce’s own Coming soon mode (WooCommerce > Settings > Site visibility) hides the store pages, but it’s meant for launching a store: it isn’t designed to let ordinary logged-in customers in. For a private trade store you need a plugin.
To give trade customers their own prices, use a wholesale plugin. The free “Wholesale Prices for WooCommerce” (by Wholesale Suite) on WordPress.org works like this:
- Install it. It adds a “Wholesale Customer” role.
- Go to Users, open each trade customer and change their role to Wholesale Customer.
- Edit a product. In the General tab, fill in the wholesale price. For variable products, fill it in on each variation.
- Log in as one of those customers and check the shop, the cart and the checkout.
The free version covers one wholesale role. Several groups, category discounts, quantity tiers and minimum orders are in its paid version or in other plugins.
For free shipping or a payment method only for trade customers (the other common question), core WooCommerce can’t filter methods by role. You need a few lines of code on woocommerce_package_rates or a plugin that sets methods per role or group.
How to stop it from happening again
The snippet works until a theme update, a new block or a cache rule brings the prices back, and it still leaves you with one price for everybody. That’s the gap our plugin TradeCraft covers. You choose whether visitors who aren’t logged in see everything, the store without prices (“Log in to see prices”, including variations, with the cart blocked) or nothing at all (a private store that sends them to log in). You put trade customers in groups (Retailers, Distributors…), and each group gets its own price per product and variation, quantity tiers, category discounts, minimum order, payment and shipping methods, and pay on account with a credit limit. Businesses apply from your store and you approve them in one click, and “Prices as…” in the admin bar shows you the store as any group. It doesn’t remove the price from the structured data, so keep the third part of the snippet above if that matters to you. It costs 49 USD a year for one site or 99 USD for life, with a demo you can try. If you only need to hide prices from guests, the snippet is enough.
FAQ
Can WooCommerce hide prices without a plugin? Yes, with a code snippet that filters the price and blocks the cart for guests. There is no setting for it in WooCommerce itself.
Will Google still see my prices if I hide them? Yes, unless you also remove them from the product’s structured data. Hiding the visible price doesn’t touch the JSON-LD.
Can I have different prices for different user roles? Not in core WooCommerce. You need a wholesale or role-pricing plugin that adds a price per role or group.
Why do guests still see prices after I added the code? Usually it’s the page cache serving an old copy, or a theme widget that draws the price without WooCommerce’s filter. Clear every cache and test in a private window.
Do wholesale customers need a special role? It depends on the plugin. Some add a new user role; others keep the normal Customer role and put customers in groups.


