Adding Content to WooCommerce Order Completion Page

You may want to add content to the WooCommerce order completion page. Unfortunately this is not possible in the standard WooCommerce structure. With a special code that we will add to our theme, you can publish great campaigns on the payment completion page. In particular, it is possible to use features such as discount codes […]

Adding Content to WooCommerce Order Completion Page

You may want to add content to the WooCommerce order completion page. Unfortunately this is not possible in the standard WooCommerce structure. With a special code that we will add to our theme, you can publish great campaigns on the payment completion page. In particular, it is possible to use features such as discount codes and attracting visitors to your social media profile in this area. This feature, which works in both debit / credit card payment and payment at the door option, sends a special message to your users who have completed the order.

Order completion page in WooCommerce is not a page structure. So there is no “Thank You” page in the Pages> Edit area. Instead, by adding a tip to the payment page, your customers are presented with details. Unfortunately, since this page is not editable, you will need to add custom code to your theme.

Adding Content to WooCommerce Order Completion Page

By adding the following php code to your theme’s functions.php file, you can show a special content on the WooCommerce payment completion (Thanks) page.

/**
 * @snippet      Adding Content to WooCommerce Order Completion Page
 * @sourcecode    https://www.wpservis.com/en/adding-content-to-woocommerce-order-completion-page
 * @testedwith    WooCommerce 3.3.4
 */
 
add_action( 'woocommerce_thankyou', 'wpcomtr_add_content_thankyou' );
 
function wpcomtr_add_content_thankyou() {
echo '<h2 class="thankstitle">GET %20 DISCOUNT!</h2><p class="thankscontent"> We have prepared a special discount code for you to use in your next order. Redeem your discount by using the code THANKS20.</p>';
}

Don’t forget to edit the content above. I have specifically defined a discount code campaign. Edit the special structure you want to make in the content. You can use thankscontent tags for the content and thanks title to style the title of the content.

Adding Content to WooCommerce Order Completion Page

How to Add PHP Code?

Many special codes on my site are added to the functions.php file. So instead of editing the functions file every time, you can use the Snippets plugin. Functions file is a system file belonging to your theme and if you do a wrong operation, your site may break. Be sure to use the Snippets plugin to avoid such a risk. Visit this post to learn how to use the Snippets plugin.

Is This Code Not Working?

I am trying to offer you some special codes, especially by researching resources. If this code doesn’t work on your site, please let me know in the comments. If you need support for WooCommerce, contact me on the WordPress support page. For the continuation of this and similar content, please follow my site on your social media accounts and share this content.

Leave a Reply

Your email address will not be published. Required fields are marked *