mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
✨ Hide Apple Pay gateway on ineligible devices
This commit is contained in:
parent
43d7e0788f
commit
3bb0496123
2 changed files with 44 additions and 12 deletions
|
@ -150,13 +150,31 @@ class ApplePayButton {
|
|||
const idButton = this.buttonConfig.button.wrapper;
|
||||
|
||||
if ( ! this.isEligible ) {
|
||||
jQuery( '#' + idButton ).hide();
|
||||
jQuery( '#' + idMinicart ).hide();
|
||||
jQuery( '#express-payment-method-ppcp-applepay' ).hide();
|
||||
const hideContainers = [
|
||||
// Payment button (Pay now, smart button block)
|
||||
`#${ idButton }`,
|
||||
// Mini Cart button
|
||||
`#${ idMinicart }`,
|
||||
// Block Checkout: Express checkout button.
|
||||
'#express-payment-method-ppcp-applepay',
|
||||
];
|
||||
|
||||
hideContainers.forEach( ( selector ) => {
|
||||
const elements = document.querySelectorAll( selector );
|
||||
|
||||
elements.forEach( ( element ) => {
|
||||
element.style.display = 'none';
|
||||
} );
|
||||
} );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Classic Checkout: Make the Apple Pay gateway visible.
|
||||
document
|
||||
.querySelectorAll( 'style#ppcp-hide-apple-pay' )
|
||||
.forEach( ( el ) => el.remove() );
|
||||
|
||||
// Add click-handler to the button.
|
||||
const setupButtonEvents = ( id ) => {
|
||||
document
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue