Vote up!
Vote down!

No attribute selected by default with custom image

I have 1 product display connected to 3 product variations, each with its own color. Automatically Commerce adds ajax and other fancy features to my node/xxx page so I can switch between the different colors and the image, price etc. will change.

But my problem is that one attribute is always selected by default. I want the user to -have- to select an attribute when he tries to add his product to the cart or else he'll get a warning that no attributes are selected.

I want this feature because I want to display a default "collection" image showing all 3 colors together before the user has made a selection and when he selects a color it switches to the image for that color. I have one image field for my collection image on my product display type and the variations have their own image field for the image displaying the selected color.

I was going to code all this myself, but seeing as Commerce ships with most of the functionality I was wondering how easy it would be to modify the existing functionality to work like I want.

Thanks in advance.

Øyvind Strømsvik

Asked by: TwiiK
on September 12, 2012


Have you solved it? I`m trying to solve similar problem and can`t find out how to do it.

- lanzs on May 20, 2013

4 Answers

Vote up!
Vote down!


check out

hook_commerce_product_reference_default_delta_alter(&$delta, $products)



The answer to all your dreams!!!

Answer by: James
Posted: Mar 30, 2016
Vote up!
Vote down!

Hi All, has anyone made any progress with this? I've followed all of the links and the closest thing to an answer was to use the fancy attributes module, which doesn't do what we are looking for.

This is causing a problem with incorrect orders on my store - I receive roughly 2 a week where people receive their order and they have forgotten to select the size they wanted - so they get the default.

Any assistance here would be greatly appreciated.

Answer by: Kirk Voltz
Posted: Nov 18, 2013