Merge pull request #2779 from woocommerce/PCP-3861-remove-empty-space-when-applepay-is-not-available

Hide payment button wrapper for ineligible buttons (3861)
This commit is contained in:
Philipp Stracker 2024-11-08 16:48:02 +01:00 committed by GitHub
commit d0e1cc1744
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -175,9 +175,9 @@ export default class PaymentButton {
/** /**
* Whether the current browser/website support the payment method. * Whether the current browser/website support the payment method.
* *
* @type {boolean} * @type {?boolean}
*/ */
#isEligible = false; #isEligible = null;
/** /**
* Whether this button is visible. Modified by `show()` and `hide()` * Whether this button is visible. Modified by `show()` and `hide()`
@ -889,6 +889,10 @@ export default class PaymentButton {
if ( ! this.isPresent ) { if ( ! this.isPresent ) {
return; return;
} }
if ( ! this.isEligible ) {
this.wrapperElement.style.display = 'none';
return;
}
this.applyWrapperStyles(); this.applyWrapperStyles();