Skip to content

Commit

Permalink
Review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bartoszpietrzak1994 committed Feb 14, 2019
1 parent 7faf166 commit 7121ced
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 8 deletions.
45 changes: 39 additions & 6 deletions docs/book/orders/cart-flow.rst
Expand Up @@ -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
----------
Expand Down
2 changes: 1 addition & 1 deletion docs/book/orders/index.rst
Expand Up @@ -12,13 +12,13 @@ with a few additional ones, like promotions, payments, shipments or checkout in
:hidden:

orders
cart-flow
taxation
adjustments
promotions
coupons
shipments
payments
checkout
cart-flow

.. include:: /book/orders/map.rst.inc
2 changes: 1 addition & 1 deletion docs/book/orders/map.rst.inc
@@ -1,9 +1,9 @@
* :doc:`/book/orders/orders`
* :doc:`/book/orders/cart-flow`
* :doc:`/book/orders/taxation`
* :doc:`/book/orders/adjustments`
* :doc:`/book/orders/promotions`
* :doc:`/book/orders/coupons`
* :doc:`/book/orders/payments`
* :doc:`/book/orders/shipments`
* :doc:`/book/orders/checkout`
* :doc:`/book/orders/cart-flow`

0 comments on commit 7121ced

Please sign in to comment.