Display a custom message for cheque payment method in WooCommerce thankyou

1.3k views Asked by At

I am trying to modify the page thanks to buy at WooCommerce, at least for the method of payment by bank check.

All I want to do is show a summary of the order and empty the cart, because currently shows me an empty page with the text that the cart has been emptied. Is there a hook that allows me to insert code on the page thanks for paying by bank check?

I found the 'woocommerce_thankyou' action but I do not know what to do with it, does anyone explain to me a little?

1

There are 1 answers

0
LoicTheAztec On

you can target cheque payment method using woocommerce_thankyou_cheque action hook, that will display a custom message on order received page for cheque payments:

add_action( 'woocommerce_thankyou_cheque', 'woocommerce_thankyou_cheque_payment', 10, 1 );
function woocommerce_thankyou_cheque_payment( $order_id ){
    if( ! $order_id ) return;

    // SET your message below
    echo '<p>'.__( 'Thanks for paying by cheque message.', 'woocommerce' ).'</p>';
}

Code goes in function.php file of your active child theme (or theme) or also in any plugin file.

This code is tested and works.