Skip to content

Commit e8cbac5

Browse files
authored
Merge pull request PrestaShop#37533 from tswfi/37532_hide_add_to_cart_from_listing_if_no_prices
If price is not shown hide add to cart too. Fixes PrestaShop#37532
2 parents d310eba + fc45a33 commit e8cbac5

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/Adapter/Presenter/Product/ProductLazyArray.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -838,6 +838,11 @@ protected function shouldEnableAddToCartButton(array $product, ProductPresentati
838838
return false;
839839
}
840840

841+
// Do not enable add to cart button if prices are hidden
842+
if (!$this->shouldShowPrice($settings, $product)) {
843+
return false;
844+
}
845+
841846
if (($product['customizable'] == 2 || !empty($product['customization_required']))) {
842847
$shouldEnable = false;
843848

tests/Integration/Adapter/Presenter/Product/ProductLazyArrayTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ public function providerDeliveryInformationCases(): iterable
342342
'allow_oosp' => OutOfStockType::OUT_OF_STOCK_AVAILABLE,
343343
]
344344
),
345-
self::PRODUCT_DELIVERY_TIME_OOSBOA,
345+
null,
346346
];
347347
}
348348

0 commit comments

Comments
 (0)