In this post I am going to explain how to create customer programmatically in magento 2. 1. Using Dependency Injection Add below code snippet in Block class. protected $storeManager; protected $customerFactory; public function __construct( \Magento\Catalog\Block\Product\Context $context, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Customer\Model\CustomerFactory $customerFactory, array $data = [] ) { $this->storeManager = $storeManager; $this->customerFactory = $customerFactory; parent::__construct($context, $data); }…


Recent Comments