♻️ Apply latest JS structure from ApplePay Gateway

- Partially addresses the known display bug
- Simplifies maintainance between both gateways
- Reduces component-internal redundancies
This commit is contained in:
Philipp Stracker 2024-07-29 21:16:53 +02:00
parent 8814b1f636
commit 8286085f59
No known key found for this signature in database
2 changed files with 299 additions and 123 deletions

View file

@ -290,6 +290,7 @@ class Button implements ButtonInterface {
$render_placeholder,
function () {
$this->googlepay_button();
$this->hide_gateway_until_eligible();
},
21
);
@ -303,6 +304,7 @@ class Button implements ButtonInterface {
$render_placeholder,
function () {
$this->googlepay_button();
$this->hide_gateway_until_eligible();
},
21
);
@ -335,6 +337,21 @@ class Button implements ButtonInterface {
<?php
}
/**
* Outputs an inline CSS style that hides the Google Pay gateway (on Classic Checkout).
* The style is removed by `GooglepayButton.js` once the eligibility of the payment method
* is confirmed.
*
* @return void
*/
protected function hide_gateway_until_eligible() : void {
?>
<style id="ppcp-hide-google-pay">
.wc_payment_method.payment_method_ppcp-googlepay { : none}
</style>
<?php
}
/**
* Enqueues scripts/styles.
*/