# Show Prices Without Tax to Business Customers

> Displays shop and cart prices excluding tax for trade roles, while regular shoppers keep seeing tax-inclusive prices.

- Type: PHP
- Runs: Run everywhere
- Category: [WooCommerce](https://wpide.com/library/category/woocommerce/)
- Requires: WooCommerce
- Tags: woocommerce, tax, b2b, prices
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/woo-excl-tax-prices-for-b2b/

## Code

```php
$wpide_b2b_display_roles = array( 'wholesale_customer', 'business' ); // Roles that see prices excluding tax.

$wpide_b2b_display = function ( $value ) use ( $wpide_b2b_display_roles ) {
    if ( ! is_user_logged_in() ) {
        return $value;
    }

    return array_intersect( $wpide_b2b_display_roles, (array) wp_get_current_user()->roles ) ? 'excl' : $value;
};

add_filter( 'option_woocommerce_tax_display_shop', $wpide_b2b_display );
add_filter( 'option_woocommerce_tax_display_cart', $wpide_b2b_display );

add_filter( 'woocommerce_get_variation_prices_hash', function ( $hash ) use ( $wpide_b2b_display ) {
    $hash['wpide_tax_display'] = $wpide_b2b_display( 'default' );

    return $hash;
} );
```

## Notes

Only changes how prices are shown; the tax charged at checkout is unchanged.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Show Prices Without Tax to Business Customers" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
