public function deleteOption($attrCode, $label) { $attributeOptionList = $this->attributeOptionManagementInterface->getItems($attrCode); foreach ($attributeOptionList as $attributeOptionInterface) { if ($attributeOptionInterface->getLabel() == $label) { $this->attributeOptionManagementInterface->delete($attrCode, $attributeOptionInterface->getValue()); } } }
/** * @param $attributeCode * @param $label * @return \Magento\Eav\Api\Data\AttributeOptionInterface|null */ public function findAttributeOptionByLabel($attributeCode, $label) { $attributeOptionList = $this->attributeOptionManagementInterface->getItems($attributeCode); foreach ($attributeOptionList as $attributeOptionInterface) { if (strcmp($attributeOptionInterface->getLabel(), $label) === 0) { return $attributeOptionInterface; } } return null; }