0

How to import color and size swatch attributes using csv.

0

Bulk update attribute options from CSV tutorial.Please click here for step by step explanation. http://www.pearlbells.co.uk/import-attribute-options-magento-2-programmatically/ enter image description here

// add new attribute options
function addNewOptions( $object_Manager, $newOptions, $storeArray ) {

$option = array();
$eavConfig = $object_Manager->get('\Magento\Eav\Model\Config');
$attribute = $eavConfig->getAttribute('catalog_product', 'color');
$option['attribute_id'] = $attribute->getAttributeId();

foreach($newOptions as $key => $value){

    $option['value'][$value][0]=$value;

    foreach($storeArray as $storeKey => $store) {
        $option['value'][$value][$storeKey] = $value;
    }   
    echo 'Added value : '.$value.PHP_EOL;
}

$eavSetup = $object_Manager->get('\Magento\Eav\Setup\EavSetup');
$eavSetup->addAttributeOption($option);

}

  • Is there anyway to import visual swatch value by CSV? – Magecode Dec 6 '17 at 10:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.