[solved] Conditional taxes B2B vs B2C pricing & roles
My brain just about melted working this out today. So this isn't a question, but it maybe someone else will find it and save a few hours of their life..
Taxes in NZ in Drupal Commerce and Wholesale(B2B) vs Retail(B2C) tax display.
Needs
- Display prices to Retail customers inclusive of tax. Store owner to enter retail prices inclusive of tax ( behaves as european VAT )
- Display prices to WS customers exclusive of tax. Store owner to enter w/s prices exclusive of tax. Tax to be added on checkout.
Everything was working well until the w/s field is left empty and the w/s customer is presented with a retail price that includes taxes. This gets pretty ugly on the checkout when the VAT is included in a price and then the 'Sales' tax gets added on to the tax inclusive price.
After a few hours of pissing about trying to get the retail tax rule to only apply itself if the user is not a wholesaler and messing around with hooks to try and overwrite the price/tax as required I stumbled across something that feels much more robust and solves all the display issues in one hit.
Make a rule:
Event: Calculating the sell price of a product
Elements( in this case):
User has role(s) wholesaler
Actions:
Remove taxes applied to a line item. Limit to just the retail tax. 'Leave the 'Increase base price...' unchecked.
Super trivial & easy to apply solution that fixes the price display right across the product listings & cart. Some days I love Drupal, others I would rather...