From a3ce5e333a814d1f6d95d01c7520f6de2ce5d48f Mon Sep 17 00:00:00 2001 From: Devansh Date: Mon, 13 Dec 2021 10:27:23 +0530 Subject: [PATCH 1/2] Child Product Lock Removed --- .../Customer/src/Http/Controllers/WishlistController.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/packages/Webkul/Customer/src/Http/Controllers/WishlistController.php b/packages/Webkul/Customer/src/Http/Controllers/WishlistController.php index 24b2cc573..ccd06dfdd 100755 --- a/packages/Webkul/Customer/src/Http/Controllers/WishlistController.php +++ b/packages/Webkul/Customer/src/Http/Controllers/WishlistController.php @@ -101,14 +101,6 @@ class WishlistController extends Controller 'customer_id' => $this->currentCustomer->id, ]); - /** - * Accidental case if some one adds id of the product in the anchor tag amd gives id of a variant. - */ - if ($product->parent_id != null) { - $product = $this->productRepository->findOneByField('id', $product->parent_id); - $data['product_id'] = $product->id; - } - if ($checked->isEmpty()) { if ($this->wishlistRepository->create($data)) { session()->flash('success', trans('customer::app.wishlist.success')); From 021f5f7c37268c1606e045f607d1b893af9c39bf Mon Sep 17 00:00:00 2001 From: Devansh Date: Mon, 13 Dec 2021 10:33:23 +0530 Subject: [PATCH 2/2] Case Added Only For Configurable --- .../Customer/src/Http/Controllers/WishlistController.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/Webkul/Customer/src/Http/Controllers/WishlistController.php b/packages/Webkul/Customer/src/Http/Controllers/WishlistController.php index ccd06dfdd..ea53c0bfa 100755 --- a/packages/Webkul/Customer/src/Http/Controllers/WishlistController.php +++ b/packages/Webkul/Customer/src/Http/Controllers/WishlistController.php @@ -101,6 +101,11 @@ class WishlistController extends Controller 'customer_id' => $this->currentCustomer->id, ]); + if ($product->parent && $product->parent->type !== 'configurable') { + $product = $this->productRepository->findOneByField('id', $product->parent_id); + $data['product_id'] = $product->id; + } + if ($checked->isEmpty()) { if ($this->wishlistRepository->create($data)) { session()->flash('success', trans('customer::app.wishlist.success'));