cancel
Showing results for 
Search instead for 
Did you mean: 

How to setColor?

How to setColor?

Hi,
$product->setName('name'); or $product->setWeight('weight); all are working. I created a custom attribute 'color' and it has two values 'Black' and 'White' as options. How can I set product's color to white when I save the product? Thank you.

1 REPLY 1

Re: How to setColor?

Hello @mage_ento

You need to set option value not an option label of that custom attribute. you can simply identify that option value using developer console.

 

See this image you will have a better idea. : https://prnt.sc/iodyll

Was my answer helpful? You can accept it as a solution.
175+ Professional Extensions for M1 & M2
Need a developer?Just visit Contact Us Now