Search code examples
javascriptnode.jsnext.jsstrapi

Strapi create cart on user creation


I am new to Strapi and really enjoy the headless CMS so far. Following a tuto, I built a simple eCom-like website with node/express and next. When creating a user, I create and assign automatically a cart

// in the signup logic, once you created the newUser:
await new Cart({ user: newUser._id }).save();

I am trying to do the same with Strapi but can't find a way. I tried a callback like

before save

but to no avail.

Any ideas?


Solution

  • You have no access to the user ID that do the request in life cycle of Strapi.

    Here is the related issue - https://github.com/strapi/strapi/issues/1443