WooCommerce Wholesale Price Hidden — Role-Based Visibility Guide

CodeAtoZ Engineer, CodeAtoZ
12 min read · 2330 words
Share: 𝕏 in
B2B & WHOLESALE · HIDE PRICE PRO GUIDE #5

WooCommerce Wholesale Price Hidden — Role-Based Visibility Guide (2026)

Complete WooCommerce wholesale price hidden guide — show wholesale pricing only to approved roles, hide retail RRP from trade buyers, and manage dual-price catalogues in PHP.
TiersMulti-role
PHP 8+Required
WC 7+Compatible
2026Updated

Managing WooCommerce wholesale price hidden logic across multiple customer tiers — retail customers see RRP, wholesale customers see trade pricing, distributors see a deeper discount tier, and guests see nothing — requires a layered price visibility system. This guide covers the complete WooCommerce wholesale price hidden architecture: multi-role price switching, hiding the retail RRP from trade buyers so they don’t see the margin, dual-price display for admin users, and using the wholesale price hidden filter correctly alongside the WooCommerce sale price system to avoid confusing strikethrough displays on trade product pages.

The WooCommerce wholesale price hidden system differs from simply hiding prices for guests. The challenge is managing visibility in both directions: wholesale prices must be hidden from retail visitors and guests, but retail prices (RRP) often need to be hidden from wholesale buyers to protect margin. A complete WooCommerce wholesale price hidden implementation handles both directions cleanly.

woocommerce wholesale price hidden — multi-role price visibility retail RRP hiding and dual-price architecture by CodeAtoZ
WooCommerce wholesale price hidden — multi-role visibility matrix from guest through retail to wholesale and distributor tiers

WooCommerce Wholesale Price Hidden: Visibility Matrix

Before writing any code, map out which prices each user type should see. This table defines the WooCommerce wholesale price hidden rules that the PHP implementation will enforce:

User typeRetail price (RRP)Wholesale priceDistributor price
Guest (not logged in)Hidden — login promptHiddenHidden
Retail customerVisibleHiddenHidden
Wholesale customerHidden (protect margin)VisibleHidden
DistributorHiddenHiddenVisible
AdministratorVisible (all prices)VisibleVisible

WooCommerce Wholesale Price Hidden: Multi-Role Price Resolver

The price resolver checks the current user’s role and returns the correct price for that tier. This is the core of the WooCommerce wholesale price hidden system — one function that handles all role-price combinations.

PHP — multi-role price resolver for WooCommerce wholesale price hidden
<?php
add_filter( 'woocommerce_product_get_price',          'caz_resolve_wholesale_price', 20, 2 );
add_filter( 'woocommerce_product_get_regular_price',  'caz_resolve_wholesale_price', 20, 2 );
add_filter( 'woocommerce_product_variation_get_price','caz_resolve_wholesale_price', 20, 2 );

function caz_resolve_wholesale_price( string $price, WC_Product $product ): string {
    if ( is_admin() && ! wp_doing_ajax() ) return $price;

    $user  = wp_get_current_user();
    $roles = (array) $user->roles;

    // Distributor tier — WooCommerce wholesale price hidden from lower tiers
    if ( in_array( 'distributor', $roles, true ) ) {
        $dist_price = $product->get_meta( '_caz_distributor_price' );
        return ( $dist_price !== '' && $dist_price !== null ) ? (string) $dist_price : $price;
    }

    // Wholesale tier — WooCommerce wholesale price visible, retail hidden
    if ( in_array( 'wholesale_customer', $roles, true ) ) {
        $ws_price = $product->get_meta( '_caz_wholesale_price' );
        return ( $ws_price !== '' && $ws_price !== null ) ? (string) $ws_price : $price;
    }

    // Guests: WooCommerce wholesale price hidden — return empty to trigger login prompt
    if ( ! is_user_logged_in() ) return '';

    // Retail customer: return standard price (RRP)
    return $price;
}

// Suppress sale price strikethrough for wholesale buyers — WooCommerce wholesale price hidden
add_filter( 'woocommerce_product_get_sale_price', function( $sale, $product ) {
    $user  = wp_get_current_user();
    $roles = (array) $user->roles;
    if ( array_intersect( ['wholesale_customer', 'distributor'], $roles ) ) return '';
    return $sale;
}, 20, 2 );

WooCommerce Wholesale Price Hidden: Hide RRP from Trade Buyers

When a wholesale buyer sees the product page, the last thing you want is for them to see the retail RRP alongside their wholesale price — it reveals your margin and can create friction. The WooCommerce wholesale price hidden system must suppress the retail price display for trade roles while still showing the correct wholesale price.

PHP — hide retail RRP from wholesale buyers in the WooCommerce wholesale price hidden system
<?php
add_filter( 'woocommerce_get_price_html', 'caz_wholesale_price_display_html', 20, 2 );

function caz_wholesale_price_display_html( string $price_html, WC_Product $product ): string {
    $user  = wp_get_current_user();
    $roles = (array) $user->roles;

    if ( ! array_intersect( ['wholesale_customer', 'distributor'], $roles ) ) {
        return $price_html;
    }

    // For wholesale roles: show only the resolved price, no RRP strikethrough
    // WooCommerce wholesale price hidden: rebuild clean price display
    $resolved = caz_resolve_wholesale_price( $product->get_price(), $product );
    if ( '' === $resolved ) return $price_html;   // fallback to original if no tier price set

    return '<span class="woocommerce-Price-amount amount">'
        . wc_price( $resolved )
        . '</span>'
        . '<span class="caz-trade-label"> ' . __( 'Trade price', 'caz-b2b' ) . '</span>';
}

// Also suppress the price range display for variable products
// WooCommerce wholesale price hidden for variable products
add_filter( 'woocommerce_variable_sale_price_html',    '__return_empty_string' );
add_filter( 'woocommerce_variable_price_html', function( $html, $product ) {
    $user  = wp_get_current_user();
    $roles = (array) $user->roles;
    if ( ! array_intersect( ['wholesale_customer','distributor'], $roles ) ) return $html;
    // Rebuild range from wholesale variation prices only
    $prices = [];
    foreach ( $product->get_children() as $vid ) {
        $v = wc_get_product( $vid );
        $p = $v ? caz_resolve_wholesale_price( $v->get_price(), $v ) : '';
        if ( $p !== '' ) $prices[] = (float) $p;
    }
    if ( empty( $prices ) ) return $html;
    sort( $prices );
    $min = wc_price( $prices[0] );
    $max = wc_price( end( $prices ) );
    return $min === $max ? $min : $min . ' — ' . $max;
}, 20, 2 );

The WooCommerce pricing hooks documentation covers all available filters for the WooCommerce wholesale price hidden system. The WooCommerce product data store documentation covers how per-product wholesale price meta is stored and retrieved. See our WooCommerce B2B wholesale pricing guide for setting up the wholesale role and storing per-product prices, and our WooCommerce hide price for guests guide for the guest visibility layer of this WooCommerce wholesale price hidden system.

💡 Always apply the WooCommerce wholesale price hidden filter at priority 20 or higher — not the default 10. Priority 10 fires before some WooCommerce core price calculations complete. Priority 20 ensures your WooCommerce wholesale price hidden logic runs after WooCommerce has resolved the base price, preventing edge cases with sale prices, scheduled prices, and variable product price ranges.

OFFICIAL PLUGIN

Hide Price Pro — Complete Wholesale Price Visibility Control

Multi-tier wholesale price hidden rules — per role, per category, per product. RRP suppression for trade buyers, variable product support, and zero PHP required.

View Hide Price Pro →

Frequently Asked Questions — WooCommerce Wholesale Price Hidden

How do I hide wholesale prices from retail customers in WooCommerce?

Use the woocommerce_product_get_price filter to check the current user’s role and return the appropriate price. For retail customers, return the standard product price. For wholesale customers, return the _caz_wholesale_price meta value. For guests, return an empty string to trigger a login prompt. Apply the filter at priority 20 to ensure the WooCommerce wholesale price hidden logic runs after core price resolution.

How do I hide the retail RRP from wholesale buyers in WooCommerce?

Filter woocommerce_get_price_html to rebuild the price display HTML for wholesale roles without the strikethrough RRP. Return only the trade price wrapped in woocommerce-Price-amount markup, suppressing WooCommerce’s standard sale price display format. Also filter woocommerce_product_get_sale_price to return an empty string for wholesale roles, which prevents the WooCommerce wholesale price hidden system from showing confusing retail-vs-sale price comparisons.

Can I have more than two pricing tiers in WooCommerce?

Yes — add one WordPress user role and one product meta key per pricing tier. The price resolver checks roles in priority order: distributor first, then wholesale, then retail, then guest. Store _caz_distributor_price, _caz_wholesale_price, and standard price as separate values per product. The WooCommerce wholesale price hidden system scales to as many tiers as needed with this pattern — just add role checks and meta keys for each additional tier.

Does WooCommerce wholesale price hidden work with variable products?

Yes, but you must filter both woocommerce_product_get_price for individual variations and woocommerce_variable_price_html for the price range display on the variable product page. Without filtering the variable HTML filter, the product page will show a retail price range even when the wholesale price resolver is active for individual variations. See the code above for the variable product WooCommerce wholesale price hidden implementation.

How do I set wholesale prices for products in the WooCommerce admin?

Add input fields to the WooCommerce product options pricing panel using the woocommerce_product_options_pricing action and woocommerce_wp_text_input. Save the values in woocommerce_process_product_meta using update_post_meta. This creates _caz_wholesale_price and _caz_distributor_price meta fields on each product that the WooCommerce wholesale price hidden resolver reads. Our B2B wholesale pricing guide covers the full admin field implementation.

Is there a plugin that handles WooCommerce wholesale price hidden rules without code?

Yes — Hide Price Pro manages the complete WooCommerce wholesale price hidden system through a configuration interface: per-role price visibility rules, per-category overrides, RRP suppression for trade buyers, variable product price range rebuilding, and AJAX cart protection. It eliminates all the PHP described in this guide and provides a tested, maintained solution for stores that need multi-tier WooCommerce wholesale price hidden rules.

Need Multi-Tier Wholesale Pricing on Your WooCommerce Store?

Hide Price Pro handles the complete WooCommerce wholesale price hidden system — multi-role tiers, RRP suppression, variable products, and zero PHP required.

CodeAtoZ
Lead Engineer & Founder, CodeAtoZ

10+ years building Magento 2 and WooCommerce platforms for high-volume e-commerce businesses. Writes about performance engineering, plugin architecture, and scalable commerce systems.

Join the Discussion

Your email address will not be published. Required fields are marked *