diff --git a/docs/book/orders/cart-flow.rst b/docs/book/orders/cart-flow.rst index 4e79cd140e5..a9b47d875a3 100644 --- a/docs/book/orders/cart-flow.rst +++ b/docs/book/orders/cart-flow.rst @@ -2,19 +2,52 @@ single: Cart flow Cart flow -====== +========= -**Cart** in Sylius is an **Order** in the state ``cart``. +Picture the following situation - a user comes to a Sylius shop and they say: +**"Someone's been using my cart! And they filled it all up with some items!"** Let's avoid such moments of surprise +by shedding some light on Sylius cart flow, shall we? + +**Cart** in Sylius represents an **Order** that is not placed yet. It represents an order that is in progress (not placed yet). .. note:: - Each user has their own cart when logged into Sylius. It can be cleared either by placing an order or removing items manually. + In Sylius each visitor has their own cart. It can be cleared either by placing an order, removing items manually + or using cart clearing command. There are several cart flows, depending on the user being logged in or what items are currently placed in the cart. -* Not logged in user adds some items to the cart and then logs in as a customer whose cart had not been empty. **It will result in dropping the cart created by an unknown user and load the cart previously created by the logged in customer.** -* Not logged in user adds some items to the cart and then logs in as a customer whose cart had been empty. **It will result in setting the cart created by an unknown user as a cart that belongs to a logged in customer.** -* Logged in user adds some items to the cart and then logs out. **Once customer logs out, their cart is not transferred to a session that belongs to an unknown user.** +First scenario:: + + Given there is a not logged in user + And this user adds a blue T-Shirt to the cart + And this user adds a red cap to the cart + And there is a customer identified by email "sylius@example.com" with not empty cart + When the not logged in user logs in using "sylius@example.com" email + Then the cart created by a not logged in user should be dropped + And the cart previously created by the user identified by "sylius@example.com" should be set as the current one + +Second scenario:: + + Given there is a not logged in user + And this user adds a blue T-Shirt to the cart + And this user adds a red cap to the cart + And there is a customer identified by email "sylius@example.com" with an empty cart + When the not logged in user logs in using "sylius@example.com" email + Then the cart created by a not logged in user should not be dropped + And it should be set as the current cart + +Third scenario:: + + Given there is a customer identified by email "sylius@example.com" with an empty cart + And this user adds a blue T-Shirt to the cart + And this user adds a red cap to the cart + When the user logs out + And views the cart + Then the cart should be empty + +.. note:: + The cart mentioned in the last scenario will we available once you log in again. Learn more ---------- diff --git a/docs/book/orders/index.rst b/docs/book/orders/index.rst index e8e9fc1ed72..69ff567502a 100644 --- a/docs/book/orders/index.rst +++ b/docs/book/orders/index.rst @@ -12,6 +12,7 @@ with a few additional ones, like promotions, payments, shipments or checkout in :hidden: orders + cart-flow taxation adjustments promotions @@ -19,6 +20,5 @@ with a few additional ones, like promotions, payments, shipments or checkout in shipments payments checkout - cart-flow .. include:: /book/orders/map.rst.inc diff --git a/docs/book/orders/map.rst.inc b/docs/book/orders/map.rst.inc index dd8b351399c..1c786c2504a 100644 --- a/docs/book/orders/map.rst.inc +++ b/docs/book/orders/map.rst.inc @@ -1,4 +1,5 @@ * :doc:`/book/orders/orders` +* :doc:`/book/orders/cart-flow` * :doc:`/book/orders/taxation` * :doc:`/book/orders/adjustments` * :doc:`/book/orders/promotions` @@ -6,4 +7,3 @@ * :doc:`/book/orders/payments` * :doc:`/book/orders/shipments` * :doc:`/book/orders/checkout` -* :doc:`/book/orders/cart-flow`