From 7936b98f8516f6877ef9a4939861183215be7087 Mon Sep 17 00:00:00 2001 From: Michael MAS <147600733+michaelmaslengow@users.noreply.github.com> Date: Thu, 12 Mar 2026 17:19:10 +0100 Subject: [PATCH 1/2] fix(orders): [PCMT-1475] Remove useless condition --- classes/models/LengowCart.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/classes/models/LengowCart.php b/classes/models/LengowCart.php index 6cc21849..2fc13b4a 100755 --- a/classes/models/LengowCart.php +++ b/classes/models/LengowCart.php @@ -156,9 +156,7 @@ public function updateQty( if (isset(self::$_totalWeight[$this->id])) { unset(self::$_totalWeight[$this->id]); } - if ((!$product->available_for_order && !$this->forceProduct) - || (Configuration::get('PS_CATALOG_MODE') && !defined('_PS_ADMIN_DIR_')) - ) { + if (!$product->available_for_order && !$this->forceProduct) { return false; } // check if the product is already in the cart From 8818332bda661c10f977a8a982810680dc0e65b3 Mon Sep 17 00:00:00 2001 From: Michael MAS <147600733+michaelmaslengow@users.noreply.github.com> Date: Wed, 1 Apr 2026 08:53:54 +0200 Subject: [PATCH 2/2] Fix stock check logic in LengowCart.php --- classes/models/LengowCart.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/classes/models/LengowCart.php b/classes/models/LengowCart.php index 2fc13b4a..0382e74f 100755 --- a/classes/models/LengowCart.php +++ b/classes/models/LengowCart.php @@ -139,7 +139,7 @@ public function updateQty( if (!empty($idProductAttribute)) { $version = defined('_PS_VERSION_') ? _PS_VERSION_ : ''; // for PrestaShop 8.0 and higher - if (version_compare($version, '8.0.0.0', '>=')) { + if (version_compare($version, '8.0.0.0', '>=') && !isset($skipAvailabilityCheckOutOfStock)) { $minimalQuantity = (int) ProductAttribute::getAttributeMinimalQty($idProductAttribute); } else { $minimalQuantity = (int) Attribute::getAttributeMinimalQty($idProductAttribute); @@ -156,7 +156,7 @@ public function updateQty( if (isset(self::$_totalWeight[$this->id])) { unset(self::$_totalWeight[$this->id]); } - if (!$product->available_for_order && !$this->forceProduct) { + if (!$product->available_for_order && !$this->forceProduct) { return false; } // check if the product is already in the cart @@ -183,7 +183,8 @@ public function updateQty( $qty = '+ ' . (int) $quantity; // force here if ($newQty > $productQty - && !Product::isAvailableWhenOutOfStock(!$this->forceProduct && (int) $result2['out_of_stock']) + && !$this->forceProduct + && !Product::isAvailableWhenOutOfStock((int) $result2['out_of_stock']) ) { return false; } @@ -320,4 +321,4 @@ public function validateFieldLengow($fieldName, $errorType) $this->{$fieldName} = Context::getContext()->language->id; } } -} +}