[Guide] Creating customers in WooCommerce

Table Of Contents

  • Introduction
  • Step 1: Create an outgoing configuration
  • Step 2: Create a route
  • Step 3: (Recommended) Create a check to prevent duplicated customers
  • Additional information

Introduction

This article describes how to create customers in WooCommerce.

Step 1: Create an outgoing configuration

  • Navigate to “Connections” in the menu and select “Outgoing”.
  • Create a new outgoing configuration to setup the process of WooCommerce customer creation.
  • Insert a name in the “name” field.
    1. For example: “WooCommerce – Customers – Create a customer”
  • Under “Publisher” select “WooCommerce - Customer - Create a customer”
  • Under “WooCommerce HTTP client” select the HTTP client that you created during the initial setup.
  • Click “Add entity transformer” and select “WooCommerce - Customer - Restructure from Alumio customer”.
    1. This transformer converts data from the Alumio customer schema to a format that WooCommerce understands.

Step 2: Create a route

Next you’ll create a route to bind the incoming configuration to the outgoing configuration. In the route, you’ll need to select the outgoing configuration you created in the previous steps.

On the following links, you can find more information about creating routes and incoming configurations and subscribers.

Step 3: (Recommended) Create a check to prevent duplicated customers

When you don’t already know whether the new customer already exists, you can add a check to prevent Alumio trying to add customers again, resulting in failing tasks.

  • In the route, click “Add entity transformer” and select the “Data, transform data using mappers and conditions” transformer.
  • Click “Add data transformer” within the newly created transformer and select the “Merger transformer” option.
  • When you want to check if a customer exists based on email address:
    1. Under “Data transformer”, select “WooCommerce - Customer - Get Customer By Email”.
    2. Under “WooCommerce HTTP client” select the HTTP client that you created during the initial setup.
    3. Under “Email”, specify the path where the customer’s email address is stored within the data, using the “&{}” notation.
    • For example: “&{email}” or “&{customer.email}”.

  • When you want to check if a customer exists based on username:
    1. “Under “Data transformer”, select “WooCommerce - Customer - Get Customer By Username”.
    2. Under “WooCommerce HTTP client” select the HTTP client that you created during the initial setup.
    3. Under “Username”, specify the path where the customer’s username is stored within the data, using the “{}” notation.
    • For example: “&{username}” or “&{customer.username}”.

  • Under “Template”, fill in the following template:

{
“WooCommerceUser”: “&{@}”
}


HTML

![](https://s3-eu-central-1.amazonaws.com/euc-cdn.freshdesk.com/data/helpdesk/attachments/production/80051950623/original/o6Nt0tt4OU8a95dz8HYaI4O_3DO_VWgmcA.png?1636635300)

* Click “Add entity transformer” at the bottom of the page and select the “Data, transform data using mappers and conditions” transformer.
* Click “Add filter” and select “Value condition”.
* Under “Accessor” select “Pattern accessor”.
* Under “Pattern” insert “WooCommerceUser”.
  1. This value should match the first key specified in the “Template” in the previous steps.
* Select “Add conditions” and select “Is empty”.

![](https://s3-eu-central-1.amazonaws.com/euc-cdn.freshdesk.com/data/helpdesk/attachments/production/80051950639/original/KRphCnWHziJtUsFiIQJUUwHZoxbZlBoW0Q.png?1636635305)

### **Additional information**

If you added the check in step 3, no task will be created in your Alumio dashboard if the user already exists in the WooCommerce website.

There’s also a transformer available (“WooCommerce - Customer - Create a customer”) that has the same functionalities as this outgoing configuration. You can use this in case you like to add additional steps in your route after you created the customer, like storing the new customer ID.

This outgoing configuration uses the [Alumio customer schema](https://schemas.alumio.com/interfaces/customer.html).

**That’s it!**

You should now be able to create customers in WooCommerce!