From e97e464fd8f843f97a556c64557930b393afce62 Mon Sep 17 00:00:00 2001
From: Philipp Stracker
Date: Fri, 8 Nov 2024 14:39:06 +0100
Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Hide=20payment=20button=20wrappe?=
=?UTF-8?q?r=20when=20not=20eligible?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../resources/js/modules/Renderer/PaymentButton.js | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/modules/ppcp-button/resources/js/modules/Renderer/PaymentButton.js b/modules/ppcp-button/resources/js/modules/Renderer/PaymentButton.js
index 6ffc24249..349f1e069 100644
--- a/modules/ppcp-button/resources/js/modules/Renderer/PaymentButton.js
+++ b/modules/ppcp-button/resources/js/modules/Renderer/PaymentButton.js
@@ -175,9 +175,9 @@ export default class PaymentButton {
/**
* 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()`
@@ -889,6 +889,10 @@ export default class PaymentButton {
if ( ! this.isPresent ) {
return;
}
+ if ( ! this.isEligible ) {
+ this.wrapperElement.style.display = 'none';
+ return;
+ }
this.applyWrapperStyles();