How To Use A Custom Price Suffix For Wholesale Users

Table Of Contents

    When setting up tax, some countries require you to show a non-inclusive price for your wholesale customers while still keeping an inclusive price for regular retail customers.

    It’s pretty common to set the Price Suffix setting to something like “Inc. VAT”, “Inc. GST” or even “Inc Tax”, but when you have the wholesale prices showing throughout the store as the non-inclusive price this might need to change for those users only.

    We are planning on adding this feature to our WooCommerce Wholesale Prices Premium plugin in the future, but in the meantime, this can be achieved by putting the code snippet below into your functions.php file in your theme.

    function fixWholesalePriceSuffix($price_display_suffix) {
    	global $current_user;
    
    	if (isset($current_user) && class_exists('WWP_Wholesale_Roles')) {
    		$wwp_wholesale_roles = WWP_Wholesale_Roles::getInstance();
    		if (!empty($wwp_wholesale_roles->getUserWholesaleRole())) {
    			return ' ex. GST';
    		}
    	}
    
    	return $price_display_suffix;
    }
    
    add_filter('woocommerce_get_price_suffix', 'fixWholesalePriceSuffix', 10, 1);
    

    Simply replace ‘ ex. GST’ with the string of your choice and this will only be applied for wholesale users.

    in WooCommerce Wholesale Prices
    [data-image-id='gourmet_bg']
    [data-image-id='gourmet_bg']
    [data-image-id='gourmet_bg']
    [data-image-id='gourmet_bg']
    [data-image-id='gourmet_bg']
    [data-image-id='gourmet_bg']
    [data-image-id='gourmet']
    [data-image-id='gourmet']
    [data-image-id='gourmet']
    [data-image-id='gourmet']
    [data-image-id='gourmet']
    [data-image-id='gourmet']
    [data-image-id='gourmet']
    [data-image-id='gourmet']
    [data-image-id='gourmet']
    [data-image-id='gourmet']