How can I add an extra button in WooCommerce checkout page?
Question
I have added extra fields in checkout page, by using hooks. I have also added a button that should just print a message if the custom field input is valid. The problem is that when I click on my custom button, the order is submitted, just like when I click “Submit order”.
function vat_check_button() {
?>
<button class="button alt" onclick="myFunction()">Έλεγχος ΑΦΜ</button>
<p id="vat_check_button"></p>
<script>
function myFunction() {
document.getElementById("InvoiceVat").innerHTML = "Hello World";
}
</script>
<?php
}
add_action('woocommerce_before_checkout_billing_form', 'vat_check_button');
0
hooks, woocommerce
3 years
2020-03-25T08:50:55-05:00
2020-03-25T08:50:55-05:00 0 Answers
108 views
0
Leave an answer