Home » Php » php – WP Woocommerce checkout page. Change the "Place Order" button to email the checkout form

php – WP Woocommerce checkout page. Change the "Place Order" button to email the checkout form

Posted by: admin February 25, 2020 Leave a comment

Questions:

I do not need to process the payment online, the business owner want to receive the order as an email and then he will call the buyer by phone.
The checkout form will not show any shipping or payment option, just the buyer info, product, quantity and total price, no tax.

My idea is the following:
In the 2 files Plugin/Woocommerce/templates/checkout/ form-checkout.php and payment.php

Modifying the code in form-checkout.php:

<form name="checkout" method="post" class="checkout woocommerce-checkout" action="<?php echo esc_url( wc_get_checkout_url() ); ?>" enctype="multipart/form-data">

to

<form method="post" action="./formcontact.php">

formcontact.php will send the email, no worry there.

Modifying the code in payment.php:

<?php echo apply_filters( 'woocommerce_order_button_html', '<button type="submit" class="button alt" name="woocommerce_checkout_place_order" id="place_order" value="' . esc_attr( $order_button_text ) . '" data-value="' . esc_attr( $order_button_text ) . '">' . esc_html( $order_button_text ) . '</button>' ); ?>

to

<?php echo apply_filters( 'woocommerce_order_button_html', 
'<button type="submit">Email Order</button>' ); ?>

What do you think?
Thank you in advance for your answers.

How to&Answers: