1. Home
  2. Knowledge Base
  3. WooCommerce Wholesale Pro
  4. Advanced Usage

How to display wholesale prices without tax

The WooCommerce Wholesale Pro plugin comes with various tax settings for your B2B user roles. You can:

  • Choose whether to charge tax for each wholesale role.
  • Decide whether prices in the shop will be displayed including or excluding tax (regardless of whether they actually pay tax).

Display prices without tax in the cart and checkout

The Display prices in the shop option only controls how prices are displayed on your shop, category and product pages - it doesn't affect how tax information is shown on the cart or checkout. As a result, we have provided the following code snippet for users who wish to show all prices exclusive of VAT in the cart and checkout to wholesale users.

add_filter( 'option_woocommerce_tax_display_cart', 'my_custom_woocommerce_tax_display_cart' );
function my_custom_woocommerce_tax_display_cart( $value ) {
    if ( is_admin() || ! function_exists( 'Barn2\Plugin\WC_Wholesale_Pro\woocommerce_wholesale_pro' ) ) {
        return $value;
    }
    
    if ( Barn2\Plugin\WC_Wholesale_Pro\Util::get_wholesale_role_for_user() ) {
        $value = 'excl';
    }
    
    return $value;
}

Notes:

  • When you use this code snippet, it is important that you set the Display prices in the shop option to show prices excluding tax.
  • For most sites, you should add the code snippet to the functions.php file in your theme or child theme. If you don't know how to do this then you should ask your developer, or post a job on Codeable to find a developer who can do it for you.

Display different price display suffixes for retail and wholesale customers

In some scenarios, it might be useful to show a different price suffix for retail and wholesale customers. For example, the tax settings of the store might be configured so that prices are shown inclusive of taxes but one or more of your wholesale roles are configured to display prices in the store without taxes. In that situation, it would be useful to use a specific price display suffix for wholesale roles, particularly the ones that are set to show prices excluding taxes.

The following code snippet filters the price display suffix, setting a custom value for wholesale roles that have the Display prices in the shop option set as "Excluding tax".

add_filter( 'option_woocommerce_price_display_suffix', 'wwp_price_display_suffix' );
function wwp_price_display_suffix( $suffix ) {
	if ( function_exists( 'Barn2\Plugin\WC_Wholesale_Pro\woocommerce_wholesale_pro' ) ) {
		$role = Barn2\Plugin\WC_Wholesale_Pro\Util::get_current_user_wholesale_role_object();
		
		if ( $role && $role->get_tax_display_shop() === 'excl' ) {
			$suffix = '({price_including_tax} incl. tax)';
		}
	}
	
	return $suffix;
}

Related Articles

If searching the knowledge base hasn't answered your question, please contact support.