2

We're in the process of setting up our Magento 2 dev site, and in creating some drop-down elements that will display on the front-end if selected, it occurred to me that there doesn't appear to be a way to create a drop-down type element that doesn't have a value set as "Is Default."

I'd like to have it work so that if a product has a value for that particular attribute, then it displays the value on the product page, but if it doesn't have that attribute in our data, then the field doesn't display. As it is, I can't not have data in a drop-down element, because the "Is Default" is required to be set, so whatever that's set to appears on our site.

Now, I could always create a default value of, say, "none selected" and then use php in the product page templates to say something like:

if($attribute name != "none selected"): [code to display attribute value]...

But, I'd prefer it if I wasn't forced to select a default value in the first place. Is there something I'm missing?

1 Answer 1

1

I recently ran into this issue and have been wondering the same thing. I've been playing with a possible workaround I thought I'd share.

I'm in CE version 2.0.7 and have found it possible to set no value on drop down attributes via the product grid mass action feature. While using 'Update attributes' you can check the box to Change the attribute but leave the drop down blank. After Save the selected product(s) do not have a value set for the changed drop down attribute.

Not satisfying or easy but possible.

0

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.

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