admin管理员组

文章数量:1334418

I am offering customers a repurchase on the order confirmed page. If they click the link they are sended directly to the checkout page. However, the form is then prefilled with the previous data. I would like to clear it, because the idea is one product(ticket) per person.

So far i have the following (and in the page source i can see the script is loaded):

function print_script() {

if (isset($_GET['extrapersoon']) && is_page(21560)){

    echo '<script>
window.addEventListener("load", function(){myFunction()};

function myFunction() {
  document.getElementsByClassName("woocommerce-checkout").reset(); 
}
</script>';
        }
  }
add_action('wp_print_scripts', 'print_script');

I tried other triggers too, such as window.load but no result yet.

Anyone?

本文标签: How to clear woocommerce checkout form after pageload