Hey there, I have a store where we import all our prices excluding tax and then adjust tax settings accordingly in b2bking and or the code of the website. Our tax is displaying for logged in users using a code snippet.
//add tax for b2c logged in
add_filter( 'woocommerce_get_price_html', 'bbloomer_alter_price_display2', 9999, 2 );
function bbloomer_alter_price_display2( $price_html, $product ) {
// ONLY ON FRONTEND
// ONLY IF PRICE NOT NULL
if ( '' === $product->get_price() ) return $price_html;
// IF CUSTOMER LOGGED IN, APPLY 15% TAX
if ( wc_current_user_has_role( 'customer' ) ) {
$orig_price = wc_get_price_to_display( $product );
$price_html = wc_price( $orig_price * 1.15 );
}
return $price_html;
}
as you can see with the if statement i check if the are logged in as customer and then apply the tax. I tried creating a new function like this to add the tax to the guest users with no luck as Im not sure what to set the role as or how to identify guest users in b2bking.
I also tried setting the VAT with the included dyanmic rules but that does not work at all.
Please could you look into providing me the identifier for guest users on b2bking so they can also see the correct including VAT price?