I need to show prices without tax for specific user role. Other available roles should see prices with included tax. How I can achieve this behavior?
1 Answer
ubercart adds taxes in hook_entity_view_alter( uc_taxes_entity_view_alter)
So I implement hook_entity_view_alter in my module
function mymodule_entity_view_alter(&$build, $entity_type) {
global $user;
if($user && in_array(constant('SOME_USER_ROLE'), $user->roles)) {
return;
}
// ...
}
Also unimplement uc_taxes implemetation of hook_entity_view_alter using hook_module_implements_alter
function mymodule_module_implements_alter(&$implementations, $hook) {
if (in_array($hook, array( 'entity_view_alter'))) {
unset($implementations['uc_taxes']);
}
}