user3715275
user3715275

Reputation: 95

Display a custom text on the Order Received Page just before order details

I am having difficulties customizing the text location on my Thankyou page/Order Received page. I got some custom text added, but I can't get it into the position I'd like.

See attached image. It is should up at the top, when I would like it under the photo in the "Order Details section)

/**
 * Custom text on the receipt page.
 */
function isa_order_received_text( $text, $order ) {
    $new = $text . ' If you do not see the download button(s) below, please refresh the page. Processing can take a few minutes.';
    return $new;
}
add_filter('woocommerce_thankyou_order_received_text', 'isa_order_received_text', 10, 2 );

enter image description here

Upvotes: 1

Views: 2219

Answers (1)

LoicTheAztec
LoicTheAztec

Reputation: 254362

To get this easily, you can use woocommerce_thankyou hook with the highest priority (1), this way:

add_action( 'woocommerce_thankyou', 'custom_thankyou_text', 1, 0);
function custom_thankyou_text(){
    echo '<p class="thankyou-custom-text">If you do not see the download button(s) below, please refresh the page. Processing can take a few minutes.</p>';
}

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

Code is tested and works.

Upvotes: 4

Related Questions