Skip to content

Commit 4472ea2

Browse files
committed
Update README.md
1 parent 339bae9 commit 4472ea2

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,17 @@ Check if cart is empty: **Cart::isEmpty()**
201201
Cart::isEmpty();
202202
```
203203

204+
Get cart total quantity: **Cart::getTotalQuantity()**
205+
206+
```php
207+
/**
208+
* get total quantity of items in the cart
209+
*
210+
* @return int
211+
*/
212+
$cartTotalQuantity = Cart::getTotalQuantity();
213+
```
214+
204215
Get cart subtotal: **Cart::getSubTotal()**
205216

206217
```php
@@ -388,6 +399,25 @@ Then Finally you can call **Cart::getSubTotal()** to get the Cart sub total with
388399
$cartSubTotal = Cart::getSubTotal(); // the subtotal will be calculated based on the conditions you have provided
389400
```
390401

402+
Add condition to exisiting Item on the cart: **Cart::addItemCondition($productId, $itemCondition)**
403+
404+
Adding Condition to an existing Item on the cart is simple as well.
405+
406+
This is very useful when adding new conditions on an item during checkout process like coupons and promo codes.
407+
Let's see the example how to do it:
408+
409+
```php
410+
$productID = 456;
411+
$coupon101 = new CartCondition(array(
412+
'name' => 'COUPON 101',
413+
'type' => 'coupon',
414+
'target' => 'item',
415+
'value' => '-5%',
416+
));
417+
418+
Cart::addItemCondition($productID, $coupon101);
419+
```
420+
391421
Clearing Cart Conditions: **Cart::clearCartConditions()**
392422
```php
393423
/**

0 commit comments

Comments
 (0)