Consider a product. For example it has 5 different colors that is 5 product variations. But all other values of the product's attributes (size, weight etc.) are the same for all the variations of the product regardless of the color. That is all 5 variations of the same product have the same weight e.g. 2 kg.

Unfortunately, the module Drupal Commerce allows a buyer in the front-end to select by clicking radio input of a color and add corresponding variation of the product to the cart only if before I as an admin selected and saved in the admin panel the appropriate values of ALL the attributes for ALL the variations of the same product.

So, if there are for example 5 colors of the same product and the product has a weight e.g. 2 kg, in the admin panel I'm forced to open the first variation of the product, select 2 kg and for example red color, save them, then open the second variation of the same product and in total repeat all the actions 5 times, but selecting another color only.

But again, why if all the variations of the product has the same weight of 2 kg and all other attrs (except color) have also the same values as other variations of the same product? It doesn't make any sense.

So, as a developer I configured the template of the product details page to display only all the attribute values of the first variation of the product. And in the admin panel I selected and saved the attr values for the first variation only and for other variations of the same product I only selected the value of the attr color which differs for each variation (before I unchecked the checkbox "Required field" for all the attributes).

But now at the product details page in the AddToCartForm I see only the radio button of the first color (of the first product variation) and therefore can add to the cart only the first variation of the product.

The question is, how to enable the AddToCartForm to display the radio buttons of other colors and therefore enable buyers to add to the cart any of the product's variations?

p.s. Is this related to something like "purchasable entity" ?


Your Answer

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

Browse other questions tagged or ask your own question.