Skip to content

Instantly share code, notes, and snippets.

@jonathansayag
jonathansayag / magento-delete-attribute-options.php
Last active March 28, 2019 17:48
Magento PHP script to delete all values of an attribute
<?php
$attribute_code = 'ATTRIBUTE_NAME';
$attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', $attribute_code);
$options = $attribute->getSource()->getAllOptions();
$optionsDelete = array();
foreach($options as $option) {
if ($option['value'] != "") {
$optionsDelete['delete'][$option['value']] = true;