How to change the default WooCommerce Memberships thank you message

Introduction

WooCommerce is a great tool to sell products online from your WordPress website.

But WC can also be used to create a membership website using WooCommerce Memberships extension.

When a membership is sold, on the thank you page where you can find the order details, there is also a default thank you message added by WooCommerce Memberships.

This message says something like this: "Thanks for purchasing a membership! You can view more details about your membership from your account." - with a link to member's account.

How to CHANGE the default thank you message from WooCommerce Memberships extension

If you want to change the default WooCommerce Memberships thank you message, you will need to add a custom PHP code to your functions.php file which it is found in your theme or child theme folder.

woocommerce memberships custom thank you message

This is the code which needs to be added:

functions.php
function custom_memberships_thank_you(){

	$thank_you_message = "My custom thank you message here." ;

	return $thank_you_message;

}

add_filter( 'woocommerce_memberships_thank_you_message', 'custom_memberships_thank_you' );

As you have seen, all you need to do is added your custom text $thank_you_message PHP variable.

How to HIDE the default thank you message from WooCommerce Memberships extension (add-on)

If you want to completely hide this default thank you message, there is another, even easier solution for this.

You will need to add the below custom PHP code to your functions.php file:

functions.php
add_filter( 'woocommerce_memberships_thank_you_message', '__return_empty_string' );

The above code will hide the message completely because it uses the WordPress __return_empty_string() function which returns an empty string to a filter.

Conclusion

I really hope that you will find these little pieces of code useful for your website or projects. These are easy solutions to customize the default thank you message for WooCommerce Memberships extension.

Comments closed

Please contact me, if you have any questions or suggestions.