From e93c81d57b28b297ca3ff5c6584aa37abfd83fc9 Mon Sep 17 00:00:00 2001 From: Emili Castells Guasch Date: Thu, 14 Dec 2023 17:17:43 +0100 Subject: [PATCH] Move add payment method handler outside `loadScript` --- .../resources/js/add-payment-method.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/modules/ppcp-save-payment-methods/resources/js/add-payment-method.js b/modules/ppcp-save-payment-methods/resources/js/add-payment-method.js index 829877c3f..963fe0dc6 100644 --- a/modules/ppcp-save-payment-methods/resources/js/add-payment-method.js +++ b/modules/ppcp-save-payment-methods/resources/js/add-payment-method.js @@ -24,7 +24,9 @@ const init = () => { document.addEventListener( 'DOMContentLoaded', () => { - init(); + jQuery(document.body).on('click init_add_payment_method', '.payment_methods input.input-radio', function () { + init() + }); loadScript({ clientId: ppcp_add_payment_method.client_id, @@ -172,10 +174,6 @@ document.addEventListener( console.error(error) }); }); - - jQuery(document.body).on('click init_add_payment_method', '.payment_methods input.input-radio', function () { - init() - }); }) } );