SAP / spartacus-docs

Spartacus documentation published in GitHub Pages
Apache License 2.0
9 stars 22 forks source link

Discussion/doc cart's behaviour #203

Open Platonn opened 5 years ago

Platonn commented 5 years ago

There are many nuances in the cart's mechanism. It would be good to document all those. Then we can think of optimizing current architecture of OCC API and Sparatacus code. We should also cover all those documented nuances with e2e tests.

For example:

It's an open discussion. So please share thoughts in comments.

WeizhengSap commented 5 years ago
  1. When user login:

1.1. If there is no anonymous cart, we just load user's current cart. (In OCC, there is no 'load current cart' API, so we load all user's carts, and return the first one. )

1.2. If there is anonymous cart, then we load user's current cart and do the merge.

plabadie commented 5 years ago

About 'current' vs 'anonymous':

For occ calls in general in Spartacus, when a userId is required in the occ call url, the app uses the special id 'current', which tells the server to obtain the userId from the auth token provided in the request.

When no user is authenticated, the user id 'anonymous' is used in the url of occ calls that require a userId in the url.