1

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?

0

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']);
  }
} 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.