From time to time, you might want to add customers to your Magento store via a script, rather than by hand. This can be especially useful if you’re migrating from an existing solution into a Magento solution.

Setting up a customer with the bare minimum information is easy.

A couple of things of note here. Firstly, we need to set the website id, and secondly the store id. We can just grab these straight from Magento. The third thing to note is that Magento (by default) uses MD5 hashes (with salts). If no salt is given, it is blank.

So, that’s it. Simple! So, what if you want to add address information against your customer? Magento tries to keep functionality like this separate, so, you don’t add address details directly into the customer object. Instead, you grab a customer/address model object, and associate to a customer.

Image Credit: familymwr