php - Magento 2 programmatically update product save empty value to product attribute -
updating existing product's (magento ce 2.1.5) attributes values taken csv file, when values not empty string there no problem, when try save empty string, product attributes value has not been updated
$product->setwidth(""); $product->save();
the result after product save attribute value stays same value, before update. tried several other methods, mentioned elsewhere, no result
$product->setwidth(""); //does nothing $product->setdata("width",""); //does nothing $product->unsetdata("width"); //does nothing $product->setwidth(new \zend_db_expr('')); //does nothing $product->setdata("width",null); //does nothing $product->save();
so question correct way it? wonder correct way set magento 2.x attribute emtpy?
Comments
Post a Comment