From 77d6ec1dbdf5f4a83328f641bb2796d148fe7e87 Mon Sep 17 00:00:00 2001 From: Serhii Tkachenko Date: Mon, 3 Oct 2022 12:19:30 +0300 Subject: [PATCH] feat-payment): PAYPAL-1682 made PDP wallet buttons container hidden in cases when the product is not purchasable or out of stock (#2267) --- CHANGELOG.md | 1 + assets/js/theme/common/product-details-base.js | 3 +++ templates/components/products/add-to-cart.html | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d634c1d34c..a5dda6736a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Draft - Migrate Cornerstone to new "Hide Price From Guests" functionality [#2262](https://github.com/bigcommerce/cornerstone/pull/2262) - Add Accelerated buttons container into 'add to cart' popup on product details page [#2264](https://github.com/bigcommerce/cornerstone/pull/2264) +- Made PDP wallet buttons container hidden in cases when the product is not purchasable or out of stock [#2267](https://github.com/bigcommerce/cornerstone/pull/2267) ## 6.6.1 (09-14-2022) diff --git a/assets/js/theme/common/product-details-base.js b/assets/js/theme/common/product-details-base.js index 98cac84b0d..cd3f286071 100644 --- a/assets/js/theme/common/product-details-base.js +++ b/assets/js/theme/common/product-details-base.js @@ -187,6 +187,7 @@ export default class ProductDetailsBase { $input: $('[name=qty\\[\\]]', $scope), }, $bulkPricing: $('.productView-info-bulkPricing', $scope), + $walletButtons: $('[data-add-to-cart-wallet-buttons]', $scope), }; } @@ -345,9 +346,11 @@ export default class ProductDetailsBase { if (!data.purchasable || !data.instock) { viewModel.$addToCart.prop('disabled', true); viewModel.$increments.prop('disabled', true); + viewModel.$walletButtons.hide(); } else { viewModel.$addToCart.prop('disabled', false); viewModel.$increments.prop('disabled', false); + viewModel.$walletButtons.show(); } } diff --git a/templates/components/products/add-to-cart.html b/templates/components/products/add-to-cart.html index c686ffd498..465b4c7dfe 100644 --- a/templates/components/products/add-to-cart.html +++ b/templates/components/products/add-to-cart.html @@ -54,7 +54,7 @@ {{lang 'products.adding_to_cart'}} {{lang 'category.add_cart_announcement'}} {{#if this.with_wallet_buttons}} -
+
{{> components/common/wallet-buttons}}
{{/if}}