Skip to content

Commit

Permalink
Clean button wrapper content on each init
Browse files Browse the repository at this point in the history
  • Loading branch information
Emili Castells Guasch authored and Emili Castells Guasch committed Dec 14, 2023
1 parent c3d0039 commit 4b53649
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 4b53649

Please sign in to comment.