khushi
khushi

Reputation: 178

Display order-number in instruction field of BACS (direct bank/wire transfer) Gateway woocomerce

I want to display Order-number in BACS payment gateway Instruction that is displayed in Order-receipt Email.

how can i do this? Any help will be appreciated..Thanks.

Upvotes: 1

Views: 1607

Answers (1)

khushi
khushi

Reputation: 178

As per this Answer i got Solution https://stackoverflow.com/a/24190390/5194017

Same as in this Answer i override the file of BACS Gateway and override this function

public function thankyou_page( $order_id ) {
    if ( $this->instructions ) {
                echo wpautop( wptexturize( wp_kses_post( str_replace("{order_number}", $order_id, $this->instructions) ) ) );
            }
            $this->bank_details( $order_id );

}
public function email_instructions( $order, $sent_to_admin, $plain_text = false ) {

    if ( ! $sent_to_admin && 'bacs' === $order->payment_method && $order->has_status( 'on-hold' ) ) {
        if ( $this->instructions ) {
            echo wpautop( wptexturize( str_replace("{order_number}", $order->id, $this->instructions) ) ) . PHP_EOL;
        }
        $this->bank_details( $order->id );
    }

}

Add "{order_number}" in BACS instruction field where you want to display order number and Replace {order_number} with $order_id.

Upvotes: 2

Related Questions