I import some clients using:
$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $customerFactory = $objectManager->create('\Magento\Customer\Model\CustomerFactory'); $customer = $objectManager->create('Magento\Customer\Model\Customer')->setWebsiteId(1)->loadByEmail(' customrr@custom.com '); try { if(!empty($customer->getData('email'))) { $customer->setAttr1(1);
The client is saved with all the standard attributes, but my new attributes will not be saved. I also tried:
$customer->setCustomAttribute('Attr1','value');
but that didn't work either.
The user attribute is displayed in the Magentos 2 context menu, and the values ββare saved correctly when creating the client manually.
import magento magento2
Mr. Metz
source share