Home » Magento4 April 2017

Magento: Create Customer Programmatically

This article shows how you can programmatically (through code) create customers in Magento 1.x.

In this example code, you can find saving customer general information along with saving customer’s billing address and shipping address.

Here are the steps followed in the code below:

– The code first loads the customer by email.

– If the customer email is already present (i.e. the customer is already registered) then it checks if the customer is already logged in or not. If the customer is already logged in then it sends him/her to Customer dashboard page. Otherwise, it will send him/her to customer login page.

– If the email is not registered in the system then, it creates new customer. After that, the customer address is also saved for the newly created customer. While creating customer, you can put a custom password or let Magento generate the password.

– Customer is emailed about the creation of his/her new account.

– Log message is saved in the log file.

Here is the full source code to create new customer programmatically:

Hope this helps. Thanks.


Get New Post by Email

Find me on

FacebookTwitterGoogle+LinkedInRSS Feed