2
Answers
Vote up!
0
Vote down!

Hide Price and Add To Cart

My website is a wholesale site. I do not want prices to be displayed or even be able to add to cart unless a user has registered and been approved by a admin (in which they make their group role "WholeSale User") but the issue is, no matter what i do the price and checkout is still being displayed. I know it has some issue with "View Published Content" but was wondering if their was a way around or a module? I have been looking everywhere and i have found a lot of people with the same issue.

Thanks

Asked by: Kyle Cribbs
on January 19, 2015

2 Answers

Vote up!
0
Vote down!

https://drupalcommerce.org/questions/20019/need-remove-add-cart-button-a... has a a few options. But it might be better to do it in a node_view_alter in a custom module:

function HOOK_node_view_alter(&$build) {
  if(user_access('wholesale permission')) {
    hide($build['product:commerce_price']);
    hide($build['field_product']);
  }
}

The above was just typed in, I haven't tested it so you may well need to tweak it.

Andy @ BlueFusion
Posted: Jan 21, 2015
Vote up!
0
Vote down!

And, of course, the above is the exact opposite of what you wanted... Try:

function HOOK_node_view_alter(&$build) {
  if(!user_access('wholesale permission')) {
    hide($build['product:commerce_price']);
    hide($build['field_product']);
  }
}
Andy @ BlueFusion
Posted: Jan 21, 2015