From 76361264d9fdfff38a1af79c63141455cc4d36e3 Mon Sep 17 00:00:00 2001 From: Bozhidar Slaveykov Date: Fri, 25 Feb 2022 11:43:45 +0200 Subject: [PATCH] check product is deleted before add to cart --- src/MicroweberPackages/Cart/CartManager.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/MicroweberPackages/Cart/CartManager.php b/src/MicroweberPackages/Cart/CartManager.php index 2b2ff36eab9..3addd09d354 100644 --- a/src/MicroweberPackages/Cart/CartManager.php +++ b/src/MicroweberPackages/Cart/CartManager.php @@ -565,7 +565,21 @@ public function update_cart($data) } if ($data['for'] == 'content') { + $cont = $this->app->content_manager->get_by_id($for_id); + + if (isset($cont['is_active'])) { + if ($cont['is_active'] != 1) { + $cont = false; + } + } + + if (isset($cont['is_deleted'])) { + if ($cont['is_deleted'] > 0) { + $cont = false; + } + } + $cont_data = $this->app->content_manager->data($for_id); if ($cont == false) { return array('error' => 'Invalid product?');