mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Clean button wrapper content on each init
This commit is contained in:
parent
c3d0039f83
commit
4b536491f2
1 changed files with 5 additions and 0 deletions
|
@ -23,6 +23,11 @@ const init = () => {
|
|||
setVisibleByClass(ORDER_BUTTON_SELECTOR, getCurrentPaymentMethod() !== PaymentMethods.PAYPAL, 'ppcp-hidden');
|
||||
setVisible(`#ppc-button-${PaymentMethods.PAYPAL}-save-payment-method`, getCurrentPaymentMethod() === PaymentMethods.PAYPAL);
|
||||
|
||||
const buttonWrapper = document.querySelector(`#ppc-button-${PaymentMethods.PAYPAL}-save-payment-method`);
|
||||
while (buttonWrapper.firstChild) {
|
||||
buttonWrapper.removeChild(buttonWrapper.firstChild);
|
||||
}
|
||||
|
||||
if(getCurrentPaymentMethod() === PaymentMethods.PAYPAL) {
|
||||
loadPaypalJsScriptPromise({
|
||||
clientId: ppcp_add_payment_method.client_id,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue