3

In the thankyou.php template there is an action showing the section marked in red in the image. The problem is the caption/title "Our Bank Detals" should be above the description not beneath.

screen-dump

The code in thankyou.php that create this section is:

<?php do_action( 'woocommerce_thankyou_' . $order->payment_method, $order->id ); ?>

The above action must point to some code in some other file, which I hope I can modify using a hook in my funcitons.php. I need help :-)

thankyou.php is located:

..wp-content/plugins/woocommerce/templates/checkout/thankyou.php

I've copied it to my child-theme folder I it is necessary to edit it directly

4

I ended up inserting the payment description.
(the one you specify in the woocommerce settings in the Wordpress backend)

The "native" build-in woocommerce payment-text is static and doesn't relates to the actual selected payment method. :-(

I did this by modifying the woocommerce template file:

1: Copy this template file:

..wp-content/plugins/woocommerce/templates/checkout/thankyou.php

to

your-theme-folder/woocommerce/checkout/thankyou.php

2: Replace this line removeline

with this code:

<?php
    if ( $available_gateways = WC()->payment_gateways->get_available_payment_gateways() ) {
        foreach ( $available_gateways as $gateway ) {
            if ( $gateway->title == $order->payment_method_title) { 
                echo '<div> <h2>Payment<h2/> </div>';
                echo $gateway->payment_fields();
            }
        }
    }
?>

(my first real PHP code, so I wouldn't be surprised if you could be done smarter ;-))

Result (page in danish): screendump

The downside of this approach is that if WooCommerce one day update this template you need to remember to update it yourself!

2

Unfortunately there is no hook available to remove that "Our Bank Details" text. But, you can hide the default which is added and un-intended area by placing following rule in your theme's style.css file:

.woocommerce-order-received .woocommerce h2:nth-of-type(2) {
    display: none;
}

Then to have "Our Bank Details" at intended place, simply go to WooCommerce > Settings > Checkout > BACS and in that add <h2>Our Bank Details</h2> in the Instructions text area.

Let me know how it goes :)

2
  • Did it help? :) Jan 19 '16 at 14:52
  • In my case it was ".woocommerce-order-received .woocommerce h2:nth-of-type(1) {display: none;}" THANKS, it was a VERY GOOD answer!. I didn't know about the "nth-of-type(1)"
    – MrCalvin
    Jan 20 '16 at 18:30

Not the answer you're looking for? Browse other questions tagged or ask your own question.