Skip to main content

Utils

Helpers for working with Magento 2 entities.

Debug an entity

Print a readable dump of an entity to inspect its current state:

echo Magento2EntityHelper::debug($existingMagentoProduct);

Clear an attribute value

Set an attribute to the special "clear" value to remove it from the product:

$magentoProduct->setAttributeValue('special_price', Magento2Entity::ATTRIBUTE_VALUE_CLEAR);