Impossible to create a new WooCommerce customer using Rest API


On my website I have created a register page in react and I am using WordPress headless with WooCommerce on it.

So I was expecting to create a new user using the register page i have and as the WordPress side is by default set to create a ‘Customer” user type for any new registration.

The registration is partially working. Let me explaining. To achieve the registration I have done this:

  • On wordpress, I have installed the plugin : WP Rest user from Sk8tech
  • I have called the api /wp-json/wp/v2/users/register with a body which contain the username, email and passwork.
  • The new user is created and have the “Customer” type

However this new user do not shows up in the WooCommerce Customer Dashboard.

When I have installed the WooCommerce plugin, at first, I have change the type of user manually through the WordPress dashboard from subscriber to customer and they all shows up in the Customer part.

I have notice that WooCommerce do have an api to create a new customer /wp-json/wc/v3/customers but I cannot setup a password.

So Do I have to make 2 calls and the WooCommerce one, will automaticall create a new customer ?


, , , Seb 2 years 2020-08-31T02:10:52-05:00 0 Answers 62 views 0

Leave an answer