User Tools

Site Tools


Sidebar

magento_2:import_customers

For more details see how the Import Customers for Magento 2 extension works.

Guide for Import Customers for Magento 2

Move customers from CRM systems, third-party sources, marketplaces and other stores into your Magento 2 instance. Configure Import Customers for Magento 2 extension to set flexible integrations and operate your customer base more effectively.

  • Import customer data from the third-party platforms, marketplaces, Magento and non-Magento online stores
  • Prevent database errors and losses with file validation
  • Create multiple import profiles suitable for specific platforms
  • Execute import profiles manually or automatically
  • Import huge volumes of data (up to 100.000 users in 15 min)
  • Solve various business challenges with the 2 extra Amasty Import interfaces
Download the sample data in CSV, XML, ODS and XLSX formats: sample-customer-data.zip

The Import Structure

Amasty Import by now has 3 separate modules to carry out import tasks:

  • Import Customers: a separate import interface to deal with customer entities on the regular basis
  • Amasty One-time Import: suitable for a one-time import of any available entity
  • Amasty Import Cron Jobs: a tab to create cron jobs concerning import activity

The more Amasty modules you have, the more entities you will be able to import in the simplified module and in the Cron Jobs version. Follow Import & Export solution updates to discover new possibilities.

Import Customers Configuration

Before building import profiles, configure the basic import performance options.

Go to Stores → Configuration → Amasty Extensions → Import Customers.

General Settings

Import Batch Size - set number of customers that will be processed in an iteration.

Multi-Process Import

Enable Multi-Process Import - enable this option to perform import in multiple threads and speed up the import process.

The 'Multi-Process Import' feature requires the PHP extension 'pcntl' to be installed on the server. If you enable the feature and no performance boost happens, please ask your hoster/system administrator to check if the 'pcntl' extension is installed.

Number of Parallel Processes - if the previous option is enabled, specify the number of processes according to your server capabilities. The more parallel processes are set, the faster the import process goes, but the higher the load on the server is.

Keep in mind, that the multi-process for Amasty One-time Import and Amasty Import Cron Jobs should be enabled in the other tab.

Import Customers Profiles

The extended customer import functionality allows you to create flexible profiles for import and execute it on regular basis. To view all the profiles, proceed to System → Import Customers → Profiles.

Here you can see all existing profiles, their IDs, names, file formats, execution types and the dates of the last run/update.

New Profile Creation

Let's consider the case of new profile creation. For example, we want to set automatic import of customers from Amazon.

First of all, hit the Add New Profile button.

General Configuration

Profile Name - specify the name of the profile for internal usage. This name will be displayed in the grid.

Batch Size - set the number of customers that will be processed in an iteration. You may configure batch size for each profile separately or specify the value in general configuration and use this default value.

Actions With Customers After Importing

You can also automatically send welcome emails when the customers are imported.

Send Welcome Email - set to Yes to enable the option.

Welcome Email From - choose a store view to send emails from.

File Settings

Now we need to choose the required file type and configure its settings.

The following formats are available:

  • CSV
  • XML
  • ODS
  • XLSX

For CSV, ODS and XLSX formats you can:

Rows Merged into One - enable this option if the rows in the import files are merged.

Also, specify the Merged Rows Data Delimiter.

For a CSV file you can additionally set:

  • Field Delimiter
  • Field Enclosure Character

For a XML file specify the path to the node in the Data XPath field, e.g. if you have <items><item>1</item><item>2</item></items>, the path will be items/item.

We've chosen a CSV format.

You can download sample files for the appropriate file formation.

Import Source

Now choose a suitable import source.

Available sources:

  • Local Directory
  • File Upload
  • FTP
  • SFTP
  • URL
  • Google Sheets
  • REST API Endpoint
  • Dropbox

For Local Directory specify a File Path relative to Magento installation (e.g. var/import/import.csv).

For File Upload select the file to import. Make sure your file isn't more than 2M and it is saved in UTF-8 encoding for proper import.

If you want to use FTP / SFTP for import, you will need to fill the following fields:

  • Host
  • User
  • Password
  • File Path
  • File Name for FTP/SFTP.

For FTP you can also enable a Passive Mode.

For URL source, apart from the URL itself, provide Basic Authentication Username and Password.

The document should be opened by a direct URL, and the URL should contain the file format, e.g. https://example/download?id=19&file=-1.xml (here we use XML format). It is necessary since in Google Cloud the link to the file is used without an extension, and the Import Customers module can't validate it. Thus, you need to add the format. Additionally, if the access is shared for all users, then the username and password fields are not required. If only certain users can see the file, then you need to enter their credentials for access.

For Google Sheets specify the required URL.

When using Google Sheets (you can import a file of different formats there), you need to specify the required format and specify the same format when importing. The link to the doc should be shared with everyone.

For REST API Endpoint provide the endpoint (e.g. https://magento.instance/rest/all/V1/some/endpoint) and choose the required authentication method (No Auth, Bearer, Basic).

Dropbox Configuration

To import using Dropbox, you will need to provide the access token. Follow the steps below to get the token.

1. Go to https://www.dropbox.com/developers and sign in.

2. Hit the Create Apps button.

3. Choose an API, a type of access you need and specify the title for your folder.

Agree with the terms & conditions and click Create App. You will be automatically redirected to the folder configuration.

4. Proceed to the Permissions tab.

Grant the permissions to write the files and click Submit.

5. Return to the Settings tab.

6. Find the OAuth 2 section and hit the Generate button below the Generated access token field.

7. Copy the token and paste it into the Generated Access Token field.


As we already have a CSV file to import, we've chosen the File Upload option.

Import Settings

In this tab, you can adjust import behavior.

Import Behavior - choose a suitable behavior for import:

  • Add/Update - in this case, the extension compares customer IDs from the import file and the already existing ones in the Magento instance. If an ID is unique and doesn't exist in Magento, a new customer will be created. If a customer with the same ID exists, the extension just changes/adds the data specified in the import file.
  • Only Add - the extension imports customers with new IDs and skips the already existing ones.
  • Only Update - the extension updates the information of the existing customers and skips not existing ones.
  • Delete - the extension deletes the customers specified in the import file from Magento.

Enable Autofill for Typical Use Cases - if enabled, Fields Configuration will be automatically filled in with the settings to perform the typical use cases for importing customers from third-party systems. The setting can be used only during new profile creation.

Validation Strategy - you can either stop the import process if any error appears (Stop On Error option) or skip invalid data and continue importing (Skip Error Entities option).

Please, note that if you Skip Error Entities and some configuration issues exist, the extension will complete the import with a 'Success' status, but 0 customers will be imported.

If you choose Stop on Errors option, the status will be 'Failed'.

Allowed Errors Count - specify the number of errors to halt the import process.

Fields Configuration

In this tab, you need to choose the required entities and map fields. If you enabled the Autofill for Typical Use Cases option previously, the required fields will be automatically added and you can proceed to mapping. If the option was not enabled, you need to add the entities and fields manually.

Please, attentively check all the fields before importing. Otherwise, the extension won't be able to match the columns and will display an error.

The functionality has a tree structure. Thus, you can add any entity, any field within a particular entity, customize entity keys/field names/delimiters and so on to match the requirements of the import.

Below you can see all available for importing entities:

Apart from adding required entities and fields, you need to map all required fields and additional fields that you want to import from the file.

Let's see how to configure the mapping.

First of all, open your import file and check how it is configured. Pay attention to column names and delimiters.

As we see, in our file all columns have a custom entity key - amazon.

In this case, we need to provide the same entity key in the fields configuration.

Then we check the delimiters. In our file we have a slash as the delimiter in all root columns:

Thus, we need to specify the same delimiter in the configuration:

If ready, proceed to column names.

Since we've enabled the Autofill for Typical Use Cases and selected the Only Add behavior (as we are importing those customers for the first time), the root entity already has all obligatory fields added. Thus, we must map these ones and add any other optional fields if needed.

Now we check if we have the same columns in our import file.

Here we see that some columns are present. Email column has the same title after the custom key and delimiter, but the rest have a different column name, e.g. instead of firstname we have First-name. If the titles are identical (as we have for the email column), just leave the Import File Field empty. If they are different, we should match the other titles from the import file with the titles in Magento.

If you check all fields and see that some of the required ones are absent in the import file, set the Default Value. For example, Magento requires store_id column, but we don't have this one in our file as Amazon doesn't have this parameter. In this case, we can just provide the required ID in the Default Value field (e.g. 1).

This way, you need to check all fields and map the titles so that the extension could import customers properly. Add any entities and provide custom entity keys if needed.

NOTE: If customers belong to customer groups or segments that are not present in Magento, you need to import those groups and segments separately. See how to do it in this section.

To add the fields, click Map Fields and choose the necessary ones in the modal window. Use the search field to speed up configuration.

When the configuration is ready, upload the file in the Import Source tab. Click Save and Continue Edit.

Now you can Validate the file.

The extension will display validation progress and results in a popup window.

If the configuration was incorrect, you will see an error with the description.

In case of successful validation, you can start the import.

Automatic Import

If you have configured the mapping and the customers were imported successfully, you can set the automatic import of future users.

Run Profile by Cron - if enabled, the import will be initiated automatically by cron according to the schedule specified.

Frequency - choose a suitable import schedule.

If you choose a custom one, provide the schedule manually.

Alert Notifications

Using this tab, you can enable email notifications about errors for a particular profile.

Enable Email Alert - set to Yes to notify the recipients about failed imports.

Email Sender - choose the contact that will send automatic emails.

Email Recipients - set to whom the emails will be sent.

Email Template - select the template for failure notifications.

Profile Import History

For each profile a separate import history is available. Check the statuses, dates and logs.

Customer Groups and Segments Import

If you import customers that belong to customer groups and segments that are not present in Magento, you need to import those data separately. Let's see how to do it step by step.

1. Create a separate profile.

2. Configure File Settings, Import Source and Import Settings as described in the previous section. Do not enable the Autofill for Typical Use Cases option.

3. Proceed to the Fields Configuration tab and expand the Customer Group section.

4. Enable the section and add all the fields.

5. Find these fields in your import file and check the naming.

6. Map entity key, delimiter and field titles as described in the fields configuration section.

Don't forget to provide default values in cases any of these fields are absent in the file.

7. Validate the file and import it. As the result, you will see the new groups in the Customer Groups section of Magento.

To import customer segments, create a new profile, enable the appropriate subentities and use the same algorithm as for the groups.

We've added all the fields and mapped them. As a result, new segments have appeared.

Now you can import customers with the relevant groups and segments.

General Import History

You may also check the logs for all import profiles in one place. Navigate to System → Import Customers → History. See the statues and check details to get a full picture.

Amasty One-time Import: Fast & Easy

This extension is helpful to perform one-time operations as it has a simplified UI. If you have only the Import Customers extension, you will be able to import any customer entity, but if you will have other import extensions by Amasty, you will easily import any available entity in one place.

Go to System → Amasty Import → Import and select the entity to import.

As soon as you choose the entity, you will be able to configure import details, such as format, title, included fields, etc. Check each configuration detail for each tab in the Import Profile Configuration sections.

General Settings for One-time Import

To configure the basic options for Amasty Import, navigate to Stores → Configuration → Amasty Extensions → Import.

Enable Multi-Process Import - set to Yes to speed up the import.

The 'Multi-Process Import' feature requires the PHP extension 'pcntl' to be installed on the server. If you enable the feature and no performance boost happens, please ask your hoster/system administrator to check if the 'pcntl' extension is installed.

Number of Parallel Processes - specify the number of processes according to your server capabilities. The more parallel processes are set, the faster the import process goes, but the higher the server loads.

Amasty Import Cron Jobs

Also, the extension includes Amasty Import Cron Jobs features: you can create regular cron jobs to import any available entity.

Go to System → Amasty Import → Cron Jobs.

The more installed Amasty Import extensions you have, the more entities you can import by cron.

Click New Import Job.

Choose the entity, specify the cron job title for internal use and set the schedule for importing. The file configuration algorithm is the same as described in the Import Profile section.


Find out how to install the Import Customers extension for Magento 2 via Composer.
Rate the user guide
 stars  from 0 votes (Details)
magento_2/import_customers.txt · Last modified: 2021/06/16 14:17 by tihomirova