Skip to content

Commit 1974cc9

Browse files
author
bhavinjr
committed
added method to allowe remove item using product_id
1 parent 57c1484 commit 1974cc9

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,14 @@ To remove users all wishlist item, specify the user_id.
100100
Wishlist::removeUserWishlist(1);
101101
```
102102

103+
### Wishlist::removeByProduct()
104+
105+
To remove particular product using product_id, specify the product_id and user_id respectively.
106+
107+
```php
108+
Wishlist::removeByProduct(15, 1);
109+
```
110+
103111

104112
### Wishlist::count()
105113

src/Wishlist.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ public function removeUserWishlist($user_id)
3939
$this->instance->ofUser($user_id)->delete();
4040
}
4141

42+
public function removeByProduct($product_id,$user_id)
43+
{
44+
$this->getWishlistItem($product_id,$user_id)->delete();
45+
}
46+
4247
protected function create($product_id,$user_id)
4348
{
4449
$matchThese = ['product_id' => $product_id,'user_id' => $user_id];

0 commit comments

Comments
 (0)