From c7dd294b8e982eabbcbd6e07b330111b450a36fe Mon Sep 17 00:00:00 2001 From: Tatu Wikman Date: Fri, 29 Nov 2024 18:46:29 +0200 Subject: [PATCH 1/2] If price is not shown hide add to cart too. Fixes #37532 --- src/Adapter/Presenter/Product/ProductLazyArray.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Adapter/Presenter/Product/ProductLazyArray.php b/src/Adapter/Presenter/Product/ProductLazyArray.php index 84f0982f8fb04..7b185e00b9df1 100644 --- a/src/Adapter/Presenter/Product/ProductLazyArray.php +++ b/src/Adapter/Presenter/Product/ProductLazyArray.php @@ -838,6 +838,11 @@ protected function shouldEnableAddToCartButton(array $product, ProductPresentati return false; } + // Do not enable add to cart button if prices are hidden + if (!$this->shouldShowPrice($settings, $product)) { + return false; + } + if (($product['customizable'] == 2 || !empty($product['customization_required']))) { $shouldEnable = false; From fc45a33ac882f781b5b6e826f5fb7c87d7829c2f Mon Sep 17 00:00:00 2001 From: Tatu Wikman Date: Tue, 10 Dec 2024 20:36:28 +0200 Subject: [PATCH 2/2] change expected test result --- .../Adapter/Presenter/Product/ProductLazyArrayTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Integration/Adapter/Presenter/Product/ProductLazyArrayTest.php b/tests/Integration/Adapter/Presenter/Product/ProductLazyArrayTest.php index c3bd6e24e3d70..3dab6ac8463a8 100644 --- a/tests/Integration/Adapter/Presenter/Product/ProductLazyArrayTest.php +++ b/tests/Integration/Adapter/Presenter/Product/ProductLazyArrayTest.php @@ -342,7 +342,7 @@ public function providerDeliveryInformationCases(): iterable 'allow_oosp' => OutOfStockType::OUT_OF_STOCK_AVAILABLE, ] ), - self::PRODUCT_DELIVERY_TIME_OOSBOA, + null, ]; }