To add a “Go Back” button in the footer of the WooCommerce Thank You page, follow these steps:

Method 1: Add Button via Hook in functions.php

Add this code to your theme’s functions.php file:

function custom_add_go_back_button_thank_you() {
    echo '<p style="text-align: center; margin-top: 20px;">
            <a href="' . esc_url( wc_get_page_permalink( 'shop' ) ) . '" class="button wc-backward">
                ← Go Back to Shop
            </a>
          </p>';
}
add_action( 'woocommerce_thankyou', 'custom_add_go_back_button_thank_you', 20 );

Explanation:

  • This hook adds the button to the Thank You page.
  • The button links back to the Shop page (wc_get_page_permalink( 'shop' )).
  • You can replace the link with home_url() to go back to the homepage.

Method 2: Customize Template (For Full Control)

If you want more control, edit the WooCommerce template:

  1. Copy this file:
    wp-content/plugins/woocommerce/templates/checkout/thankyou.php
  2. Paste it into your theme:
    wp-content/themes/your-theme/woocommerce/checkout/thankyou.php
  3. Add the button before or after the existing content:
<p style="text-align: center; margin-top: 20px;">
    <a href="<?php echo esc_url( wc_get_page_permalink( 'shop' ) ); ?>" class="button wc-backward">
        ← Go Back to Shop
    </a>
</p>

Final Output:

A styled “Go Back to Shop” button will appear on the WooCommerce Thank You page. 🚀

Let me know if you need further customization!

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x