I've traied with javascript but when I come back to step 1 the button dissapears (I think its because its doing a shadow copy of the element).
const section = document.getElementById('order_checkout_payment');
let contador = 0
const observer = new MutationObserver((mutationsList, observer) => {
if (section.style.display === 'block') {
if (contador == 0) {
miFuncion();
contador += 1
}
}
});
observer.observe(section, {
attributes: false,
childList: true,
subtree: true
});
const wrapperPaypalButton = document.getElementById('ppc-button-ppcp-gateway').parentElement
function miFuncion() {
console.log(1)
const paypaylInputOption = document.getElementById('payment_method_ppcp-gateway');
if (paypaylInputOption) {
console.log(3)
const padreSectionMetodoPago = paypaylInputOption.parentElement
padreSectionMetodoPago.appendChild(wrapperPaypalButton)
}
// observer.disconnect();
}