0

enter image description here

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();
}
  • What PayPal plugin have you enabled (or are you using)?, as there are so many different. Update your question, please, adding the link to the plugin page. Note that you will not be able to do it with JavaScript as "checkout_update" event is triggered multiple times by different processes, so the PayPal button will always go back to its initial location. – LoicTheAztec Jul 31 '23 at 22:12
  • I used WooCommerce PayPal Payments. but i salved just with css. anyway thanks for help. I saw you are a master in woocomerce can you help me? I have now this problem with this pluggin it throws me error in product details in products with variations – JavierLoera Jul 31 '23 at 22:29
  • the error is this Call to a member function is_in_stock() on array – JavierLoera Jul 31 '23 at 22:30
  • 1
    So you are using somewhere, in a custom code, the method `is_in_stock()` on a variable that is not a product object... Try to enable WP_DEBUG as explained in [this thread](https://stackoverflow.com/questions/61740111/how-to-debug-in-woocommerce-3/61754061#61754061)… This way, it will be easier to find the location of the error. – LoicTheAztec Jul 31 '23 at 23:07

0 Answers0