How to limit the variations shown to a user based on custom conditions?
I'm looking to create an ordering system for a company with multiple stores (physical locations).
- There are multiple products, and each one could have a different price at each store.
- The store for the order is selected based on the user's location.
- The user's entire order must be placed with one store (i.e. they can't buy one item from one store and another item from a different store).
I'm thinking that I should create a content type for stores. I'd then create a field on the product variation that uses Entity Reference to point at the proper store node. My plan would be to create a page where the user can select their store before they start adding items to the cart. I'd then want to only show the product variation associated with their selected store.
My questions...
- First, since I haven't used Drupal Commerce before... Does this make sense?
- I was planning on saving the selected store in SESSION, but is there a solution that fits with DC better? Can I save it in the cart somehow before they start shopping?
- How can I disable / remove the variations not associated with the selected store from the product display? Are there hooks that I can use?
If it helps, I'm an experienced Drupal developer, so I'm comfortable using hooks and creating custom code / modules as needed.
Comments
Please use comments to respond to answers :D
This sounds very similar to a use case I am trying to implement. Could you post some more details of how you achieved this. I am relatively new to Drupal so need some help with hook_node_view. Thanks