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

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

Found something useful, please give "Kudos" or "Accept as Solution" for Token of Appreciation.
Free Magento Extensions : https://magecomp.com/free-magento-extensions.html