Can we delete product attribute optionoptions by using label ? for
For example say attribute:color havehas options like green,red red,yellow yellow how to delete red from this?.I I used below code.
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$eavConfig = $objectManager->get('Magento\Eav\Model\Config');
$attribute = $eavConfig->getAttribute('catalog_product', 'color);
$id = $attribute->getAttributeId();
$options = $attribute->getSource()->getAllOptions();
foreach ($options as $option) {
$options['delete'][$option['value']] = true;
$options['value'][$option['value']] = true;
}
$eavSetup = $this->_objectManager->get('Magento\Eav\Setup\EavSetup');
$eavSetup->addAttributeOption($options);
It is deleting all the options. I need to delete specific option.