Filter WooCommerce Thank You Text Order Received

You can filter the text on a WooCommerce order received after checkout, by default the text reads ‘Thank you. Your order has been received’, but you may want to add some further instruction, which you can do using the filter woocommerce_thankyou_order_received_text

woocommerce-thankyou-text

<?php
add_filter( 'woocommerce_thankyou_order_received_text', 'wpb_thankyou' );
function wpb_thankyou() {
$added_text = '<p>You can access the PDF Download from the <a href="/account-page">My Account Page</a>.</p>';
return $added_text ;
}
<?php
add_filter( 'woocommerce_thankyou_order_received_text', 'wpb_thankyou', 10, 2 );
function wpb_thankyou( $thankyoutext, $order ) {
$added_text = $thankyoutext . '<p>You can access the PDF Download from the <a href="/account-page">My Account Page</a>.</p>';
return $added_text ;
}

Above the original text is being replaced.

Or below the original text is being retained with some new text added.

<?php
add_filter( 'woocommerce_thankyou_order_received_text', 'wpb_thankyou' );
function wpb_thankyou() {
$added_text = '<p>You can access the PDF Download from the <a href="/account-page">My Account Page</a>.</p>';
return $added_text ;
}
<?php
add_filter( 'woocommerce_thankyou_order_received_text', 'wpb_thankyou', 10, 2 );
function wpb_thankyou( $thankyoutext, $order ) {
$added_text = $thankyoutext . '<p>You can access the PDF Download from the <a href="/account-page">My Account Page</a>.</p>';
return $added_text ;
}

2 Comments

  1. Isra Gonzalez on May 15, 2018 at 7:14 pm

    Hello!!! My name is Isra
    I am a developer, but I am very new to wordpress and woocommerce.
    I need to do precisely what you do in this example, but I do not know where to edit this php.
    Can you help me telling me what file do I have to edit and where I can find it?

    • Isra Gonzalez on May 15, 2018 at 7:44 pm

      Ignore all of this! I have done it!!
      I found the php file at:
      …MYDOMAIN/wp-content/themes/MYTHEME/functions.php

      Thank you for the article!!!

Leave a Comment





%d bloggers like this: