Tags/topics: 
1
Answers
Vote up!
0
Vote down!

Role based product variations

I have products with multiple variations. How can I control which variations users can see and choose based on their role?

Asked by: alexb03060
on May 15, 2013

1 Answer

Vote up!
0
Vote down!

One possible idea could be:
- Add a "role_field" to the Product Variation Type
- Implement hook_entity_view_alter (viewing products list) and hook_form_alter (altering the add_to_cart form)

Not really sure if that's the best approach.

You could also play with Views and Access Control by role, but in that case you would (possibly) need a Product Variation Type per role, for easy view creation/filtering.

Answer by: Favio Manriquez
Posted: May 15, 2013

Comments

Thanks favrik,
I've tried Access Control, but it only works with nodes (Product Displays), and with Product Variations being a part of Commerce I would need something on an Entity level. I've also tried Taxonomy Access Control module hoping to restrict access to a term referencing an attribute, but it also was a no go. I'm not that good with hooks yet, but I'll look into it. Any other suggestions are welcome.

- alexb03060 on May 16, 2013