1

Actually the Payment Instructions are displayed on Order Received page:

What I want is to display this Payment Instructions also in My account > Order view pages.

Like this:

My question: How do I make the payment instruction to appear in My account > order view pages?

I know it will be sent to the customer email but in case they are lazy to open email they can read the instructions in the order details page.

LoicTheAztec
  • 229,944
  • 23
  • 356
  • 399
Rhob Gatchalian
  • 121
  • 1
  • 3
  • 7
  • Please include a a [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) of what you have tried so far yourself. It is expected that you have researched your issue and made attempts to solve it before posting. Please read [How much research effort is expected of Stack Overflow users](https://meta.stackoverflow.com/questions/261592/how-much-research-effort-is-expected-of-stack-overflow-users) and [How do I ask a good question](https://stackoverflow.com/help/how-to-ask) – FluffyKitten Sep 08 '17 at 13:42

2 Answers2

3

Using a custom hooked function in woocommerce_order_details_after_order_table action hook in which we add the woocommerce_thankyou_{$order->get_payment_method()} hook, will do the job:

add_action( 'woocommerce_order_details_after_order_table', 'view_order_custom_payment_instruction', 5, 1); // Email notifications
function view_order_custom_payment_instruction( $order ){

    // Only for "on-hold" and "processing" order statuses and on 'view-order' page
    if( in_array( $order->get_status(), array( 'on-hold', 'processing' ) ) && is_wc_endpoint_url( 'view-order' ) ){

        // The "Payment instructions" will be displayed with that:
        do_action( 'woocommerce_thankyou_' . $order->get_payment_method(), $order->get_id() );

    }
}

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

Tested and works in WooCommerce 3+.

LoicTheAztec
  • 229,944
  • 23
  • 356
  • 399
0

It was not working for me, I had to modify the code slightly:

add_action( 'woocommerce_order_details_after_order_table', 'view_order_custom_payment_instruction', 5, 1); // Email notifications
function view_order_custom_payment_instruction( $order ){

    // Only for "on-hold" order statuses and on 'view-order' page
    if( in_array( $order->get_status(), array( 'on-hold' ) ) && is_wc_endpoint_url( 'view-order' ) ){
        WC()->payment_gateways();
        // The "Payment instructions" will be displayed with that:
        do_action( 'woocommerce_thankyou_' . $order->get_payment_method(), $order->get_id() );

    }
}
JAG
  • 26
  • 1