Skip to content

Commit 5d8dbd8

Browse files
authored
Update README.md
1 parent bcb3056 commit 5d8dbd8

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

README.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,21 +57,28 @@ php artisan vendor:publish --provider="Darryldecode\Cart\CartServiceProvider" --
5757
### IMPORTANT NOTE!
5858
By default, the cart has a default sessionKey that holds the cart data. This
5959
also serves as a cart unique identifier which you can use to bind a cart to a specific user.
60-
To override this default session Key, you will just simply call the ```session($sessionKey)``` method
60+
To override this default session Key, you will just simply call the ```\Cart::session($sessionKey)``` method
6161
BEFORE ANY OTHER METHODS!!.
6262

6363
Example:
6464

6565
```php
6666
$userId // the current login user id
6767

68-
\Cart::session($userId)->add();
69-
\Cart::session($userId)->update();
70-
\Cart::session($userId)->remove();
71-
\Cart::session($userId)->condition($condition1);
72-
\Cart::session($userId)->getTotal();
73-
\Cart::session($userId)->getSubTotal();
74-
Cart::session($userId)->addItemCondition($productID, $coupon101);
68+
// This tells the cart that we only need or manipulate
69+
// the cart data of a specific user. It doesn't need to be $userId,
70+
// you can use any unique key that represents a unique to a user or customer.
71+
// basically this binds the cart to a specific user.
72+
\Cart::session($userId);
73+
74+
// then followed by the normal cart usage
75+
\Cart::add();
76+
\Cart::update();
77+
\Cart::remove();
78+
\Cart::condition($condition1);
79+
\Cart::getTotal();
80+
\Cart::getSubTotal();
81+
\Cart::addItemCondition($productID, $coupon101);
7582
// and so on..
7683
```
7784

@@ -94,6 +101,10 @@ There are several ways you can add items on your cart, see below:
94101
* @return $this
95102
* @throws InvalidItemException
96103
*/
104+
105+
# ALWAYS REMEMBER TO BIND THE CART TO A USER BEFORE CALLING ANY CART FUNCTION
106+
# SO CART WILL KNOW WHO'S CART DATA YOU WANT TO MANIPULATE. SEE IMPORTANT NOTICE ABOVE.
107+
# EXAMPLE: \Cart::session($userId); then followed by cart normal usage.
97108

98109
// Simplest form to add item on your cart
99110
Cart::add(455, 'Sample Item', 100.99, 2, array());

0 commit comments

Comments
 (0)