In shopify to create customer we have two ways, i.e either to import directly from shopify backend in csv format or creating customer with API.

In this article i’m going to write about both ways.

Importing(in shopify) customers in CSV format : Shopify by default allows you to import customers in certain CSV format. To look at the format, if you export once from existing customers or by creating a customer manually in shopify you will know the exact format you require. Now after knowing the format shopify accepts, let’s get the information from magento store.

Now second step is exporting customers from magento store. We can export customers directly from navigating to `backend > customers > manage customers > export`

export-customer

But, we don’t get all required data for eg. shipping and billing address of customer. We have other way to export via profiler that provides us all information of a customers. For this navigate to `backend > system > import/export > dataflow profiles` choose to export customer and on running profiler you would get detailed info customer CSV file.

export-customer-dataflow-jpg

Now arrange these fields shopify recognized and validates & import from shopify `backend > customers > import customers`

import-customers-in-shopify

And shopify now sends the import result on your email.

 

Importing via API Request : We should read data from a source and then with the below request customer gets created on backend.

POST /admin/customers.json

                {
  "customer": {
    "first_name": "Steve",
    "last_name": "Lastnameson",
    "email": "steve.lastnameson@example.com",
    "verified_email": true,
    "addresses": [
      {
        "address1": "123 Oak St",
        "city": "Ottawa",
        "province": "ON",
        "phone": "555-1212",
        "zip": "123 ABC",
        "last_name": "Lastnameson",
        "first_name": "Mother",
        "country": "CA"
      }
    ]
  }
}

Reference for creating customers via API request : https://help.shopify.com/api/reference/customer#create

Activating customer account

To activate newly added customer, we should generate activation link and send emails to respective emails. The process to generate customer activation link via api call like here https://help.shopify.com/api/reference/customer#account_activation_url

Suman K.C

eCommerce Developer, writes about stuff related to eCommerce development. Currently based in Kathamandu, loves reading about startups & new technology, introvert nature, fond of traveling & playing volleyball.

More Posts - Website

Follow Me:
LinkedInGoogle Plus