🩹 Hide gateway on PayNow page when ineligible

This commit is contained in:
Philipp Stracker 2024-07-24 20:13:30 +02:00
parent 354a9ff175
commit a4d3af848c
No known key found for this signature in database
2 changed files with 6 additions and 7 deletions

View file

@ -275,7 +275,7 @@ class ApplePayButton {
}
// Classic Checkout: Apple Pay gateway.
if ( CONTEXT.Checkout === this.context ) {
if ( CONTEXT.Gateways.includes( this.context ) ) {
selectors.push( '.wc_payment_method.payment_method_ppcp-applepay' );
}
@ -364,12 +364,10 @@ class ApplePayButton {
return;
}
// Classic Checkout: Make the Apple Pay gateway visible after page load.
if ( CONTEXT.Checkout === this.context ) {
document
.querySelectorAll( 'style#ppcp-hide-apple-pay' )
.forEach( ( el ) => el.remove() );
}
// Classic Checkout/PayNow: Make the Apple Pay gateway visible after page load.
document
.querySelectorAll( 'style#ppcp-hide-apple-pay' )
.forEach( ( el ) => el.remove() );
this.allElements.forEach( ( element ) => {
element.style.display = '';

View file

@ -966,6 +966,7 @@ class ApplePayButton implements ButtonInterface {
$render_placeholder,
function () {
$this->applepay_button();
$this->hide_gateway_until_eligible();
},
21
);