2

Here's the scenario:

  • I'm selling furniture. I have a chair we'll call Mission Chair.
  • The Mission Chair comes in oak or maple, both are priced differently. I have a field in my product
  • I have a product display created which references these 2 products
  • Customers need to choose 1 of 5 stain colors, but each type of wood has 5 different choices (and they're not the same choices)
  • The stain choice is required, but does not affect the price.

In my Product Variation Type, I have a term reference field which is referencing a Wood Species vocabulary.

I assume I would create a term reference field on the line item type where they would make the stain color choice. What I need to figure out is how do I do some kind of contextual filter to only show the stains available for the chosen wood species? (which is a taxonomy term on the chosen product - not the display, the product variation)

Should the stains be child terms in the same vocabulary as the wood species, or should it be a separate vocabulary with an additional term field that references a specific wood species (taxonomy reference, the same vocabulary the product variation uses) for each stain color term, and then filter on that somehow?

2
  • Are you trying to use the standard Commerce Add to Car form (which has support for multiple attributes, and some limitations) or did you come up with a custom add to cart form?
    – acrosman
    Commented May 27, 2016 at 19:28
  • The standard Add to Cart form - just need to figure out how to do some kind of contextual filter - maybe using a views field on the line item type so I can do a contextual filter? Commented May 27, 2016 at 19:41

1 Answer 1

1

You have two basic approaches you can use: either treat the stain color as a customization or treat it as a second attribute. Which you pick depends on a little on your backend process needs and the experience you want to provide.

If you use a second attribute and have a product variation for each stain in each wood, Commerce's default add to cart form should provide the user experience you are describing. You might find it helpful to take a look at this tutorial.

If you want to treat stain as a customization you'll likely want a couple extra modules -- in particular Commerce Customizable Product. Commerce Guys have a tutorial covering that scenario.

3
  • Trying to avoid creating product variations for this - I have enough other variations to worry about which I didn't mention :-) Commented May 27, 2016 at 20:28
  • Than you'll want to treat them as product customizations (which probably makes some sense).
    – acrosman
    Commented May 27, 2016 at 20:30
  • I found this thread (drupal.org/node/1873396) which probably describes a situation somewhat similar to mine. I don't need to adjust the price based on the stain color - I just need some way of triggering a filter of the line item taxonomy reference field (or views field which would be a list of filtered taxonomy terms) based on a chosen term from the product variation - does that make sense? Commented May 27, 2016 at 20:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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