mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-01 07:02:48 +08:00
Display payment gateways also when the are set to display:none with css and the stylesheet is removed from DOM
This commit is contained in:
parent
bbd25f89e8
commit
a453e4e881
5 changed files with 28 additions and 0 deletions
|
@ -407,6 +407,11 @@ class ApplePayButton {
|
||||||
.querySelectorAll( 'style#ppcp-hide-apple-pay' )
|
.querySelectorAll( 'style#ppcp-hide-apple-pay' )
|
||||||
.forEach( ( el ) => el.remove() );
|
.forEach( ( el ) => el.remove() );
|
||||||
|
|
||||||
|
const paymentMethodAppleLi = document.querySelector('.wc_payment_method.payment_method_ppcp-applepay' );
|
||||||
|
if (paymentMethodAppleLi.style.display === 'none' || paymentMethodAppleLi.style.display === '') {
|
||||||
|
paymentMethodAppleLi.style.display = 'block';
|
||||||
|
}
|
||||||
|
|
||||||
this.allElements.forEach( ( element ) => {
|
this.allElements.forEach( ( element ) => {
|
||||||
element.style.display = '';
|
element.style.display = '';
|
||||||
} );
|
} );
|
||||||
|
|
|
@ -38,6 +38,12 @@ class CardFieldsFreeTrialRenderer {
|
||||||
if ( hideDccGateway ) {
|
if ( hideDccGateway ) {
|
||||||
hideDccGateway.parentNode.removeChild( hideDccGateway );
|
hideDccGateway.parentNode.removeChild( hideDccGateway );
|
||||||
}
|
}
|
||||||
|
const dccGatewayLi = document.querySelector(
|
||||||
|
'.wc_payment_method.payment_method_ppcp-credit-card-gateway'
|
||||||
|
);
|
||||||
|
if (dccGatewayLi.style.display === 'none' || dccGatewayLi.style.display === '') {
|
||||||
|
dccGatewayLi.style.display = 'block';
|
||||||
|
}
|
||||||
|
|
||||||
this.errorHandler.clear();
|
this.errorHandler.clear();
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,12 @@ class CardFieldsRenderer {
|
||||||
if ( hideDccGateway ) {
|
if ( hideDccGateway ) {
|
||||||
hideDccGateway.parentNode.removeChild( hideDccGateway );
|
hideDccGateway.parentNode.removeChild( hideDccGateway );
|
||||||
}
|
}
|
||||||
|
const dccGatewayLi = document.querySelector(
|
||||||
|
'.wc_payment_method.payment_method_ppcp-credit-card-gateway'
|
||||||
|
);
|
||||||
|
if (dccGatewayLi.style.display === 'none' || dccGatewayLi.style.display === '') {
|
||||||
|
dccGatewayLi.style.display = 'block';
|
||||||
|
}
|
||||||
|
|
||||||
const cardFields = paypal.CardFields( {
|
const cardFields = paypal.CardFields( {
|
||||||
createOrder: contextConfig.createOrder,
|
createOrder: contextConfig.createOrder,
|
||||||
|
|
|
@ -52,6 +52,12 @@ class HostedFieldsRenderer {
|
||||||
if ( hideDccGateway ) {
|
if ( hideDccGateway ) {
|
||||||
hideDccGateway.parentNode.removeChild( hideDccGateway );
|
hideDccGateway.parentNode.removeChild( hideDccGateway );
|
||||||
}
|
}
|
||||||
|
const dccGatewayLi = document.querySelector(
|
||||||
|
'.wc_payment_method.payment_method_ppcp-credit-card-gateway'
|
||||||
|
);
|
||||||
|
if (dccGatewayLi.style.display === 'none' || dccGatewayLi.style.display === '') {
|
||||||
|
dccGatewayLi.style.display = 'block';
|
||||||
|
}
|
||||||
|
|
||||||
const cardNumberField = document.querySelector(
|
const cardNumberField = document.querySelector(
|
||||||
'#ppcp-credit-card-gateway-card-number'
|
'#ppcp-credit-card-gateway-card-number'
|
||||||
|
|
|
@ -763,11 +763,16 @@ export default class PaymentButton {
|
||||||
|
|
||||||
const styleSelector = `style[data-hide-gateway="${ this.methodId }"]`;
|
const styleSelector = `style[data-hide-gateway="${ this.methodId }"]`;
|
||||||
const wrapperSelector = `#${ this.wrappers.Default }`;
|
const wrapperSelector = `#${ this.wrappers.Default }`;
|
||||||
|
const paymentMethodLi = document.querySelector(`.wc_payment_method.payment_method_${ this.methodId }`);
|
||||||
|
|
||||||
document
|
document
|
||||||
.querySelectorAll( styleSelector )
|
.querySelectorAll( styleSelector )
|
||||||
.forEach( ( el ) => el.remove() );
|
.forEach( ( el ) => el.remove() );
|
||||||
|
|
||||||
|
if (paymentMethodLi.style.display === 'none' || paymentMethodLi.style.display === '') {
|
||||||
|
paymentMethodLi.style.display = 'block';
|
||||||
|
}
|
||||||
|
|
||||||
document
|
document
|
||||||
.querySelectorAll( wrapperSelector )
|
.querySelectorAll( wrapperSelector )
|
||||||
.forEach( ( el ) => el.remove() );
|
.forEach( ( el ) => el.remove() );
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue