# Create new Auth0 User during Woocommerce checkout

**URL:** <https://community.auth0.com/t/create-new-auth0-user-during-woocommerce-checkout/106870>\
**Category:** Integration Help\
**Tags:** wordpress-auth0, wordpress, support\
**Created:** [May 14, 2023, 4:51am UTC](https://community.auth0.com/t/create-new-auth0-user-during-woocommerce-checkout/106870 "2023-05-14T04:51:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lynnchin](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@lynnchin](https://community.auth0.com/u/lynnchin)\
**Post date:** [May 14, 2023, 4:51am UTC](https://community.auth0.com/t/create-new-auth0-user-during-woocommerce-checkout/106870/1 "2023-05-14T04:51:02Z")

</div>

Hello,

I would like to implement a create new Auth0 user feature with Auth0 after the the Woo Commerce purchase is completed, as I don’t want the user to login into my app after they have completed their purchase through woocommerce in wordpress app.

I have done some studies on the Auth0-wordpress plugin, however, I am not sure how this can be done. Can someone provide advise on what to do if we want to create a new Auth0 User so that I can link the User to my vanilla SPA to login?

Any ideas would be appreciated. Thanks.

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [May 15, 2023, 5:59pm UTC](https://community.auth0.com/t/create-new-auth0-user-during-woocommerce-checkout/106870/3 "2023-05-15T17:59:57Z")

</div>

Hi @lynnchin,

Thanks for reaching out to the Auth0 Community!

> [@lynnchin](#):
>
> I have done some studies on the Auth0-wordpress plugin, however, I am not sure how this can be done. Can someone provide advise on what to do if we want to create a new Auth0 User so that I can link the User to my vanilla SPA to login?

Sure! You can create a new user by using the Auth0 [Management API’s Create a User endpoint](https://auth0.com/docs/api/management/v2#!/Users/post_users).

In this scenario, you will need to call the Create a User endpoint after the user has completed their purchase on your app.

Please let me know if you have any further questions.

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![lynnchin](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@lynnchin](https://community.auth0.com/u/lynnchin)\
**Post date:** [May 16, 2023, 3:09pm UTC](https://community.auth0.com/t/create-new-auth0-user-during-woocommerce-checkout/106870/4 "2023-05-16T15:09:48Z")

</div>

Thanks @rueben.tiow! Appreciate your help.

I wonder is there any code snippet or examples I can follow to do this in wordpress?

Cheers

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [May 16, 2023, 5:04pm UTC](https://community.auth0.com/t/create-new-auth0-user-during-woocommerce-checkout/106870/5 "2023-05-16T17:04:28Z")

</div>

Hi @lynnchin,

Thank you for your reply.

Yes! I attached a code snippet using an Axios POST request to create a new user.

```auto
const axios = require('axios');
let data = JSON.stringify({
  "email": "testuser@example.com",
  "password": "SECRET",
  "connection": "Username-Password-Authentication"
});

let config = {
  method: 'post',
  url: 'https://YOUR_DOMAIN/api/v2/users',
  headers: { 
    'Authorization': 'Bearer MGMT_API_TOKEN', 
    'Content-Type': 'application/json'
  },
  data : data
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});

```

I hope this helps!

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [May 30, 2023, 5:04pm UTC](https://community.auth0.com/t/create-new-auth0-user-during-woocommerce-checkout/106870/6 "2023-05-30T17:04:56Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
