Scriptfeeds Blog
  • Blog
  • WordPress
    • Woocommerce
    • WordPress Errors
    • WordPress Plugins
  • Development
    • WordPress Themes
  • Hire us
Cart / $0.00

No products in the cart.

No Result
View All Result
Scriptfeeds Blog
  • Blog
  • WordPress
    • Woocommerce
    • WordPress Errors
    • WordPress Plugins
  • Development
    • WordPress Themes
  • Hire us
Cart / $0.00

No products in the cart.

No Result
View All Result
Scriptfeeds Blog
No Result
View All Result
Home Wordpress Woocommerce

How to add custom WooCommerce thank you page without plugin

Scriptfeeds by Scriptfeeds
May 14, 2022
in Woocommerce, Wordpress
0
84
SHARES
Share on FacebookShare on TwitterWhatsapp this Blog

A custom thank you page can be very useful specially in WooCommerce Products. A custom thank you page can help you in upsell or after instructions notes for a customer after selling product. This article will help you to add custom thank you page after WooCommerce Product page. You can add any any to a thank you page using a simple redirect action.

Step by Step guide to add custom thank you page for WooCommerce Product

  • Open the WooCommerce product on which you wanna add redirect. Copy the ID of the Product (You can get the id from the url when you open the product in dashboard)
  • Click on theme editor and select the child theme of your Active theme.
  • Click on functions.php file and add the below code with your ID and custom page link.
add_action( 'woocommerce_thankyou', 'redirect_product_based', 1 ); 
function redirect_product_based ( $order_id ){
            $order = wc_get_order( $order_id );
        
            foreach( $order->get_items() as $item ) {
                // Add whatever product id you want below here
                if ( $item['product_id'] == 1565 ) {
                    // change below to the URL that you want to send your customer to
                     wp_redirect( 'https://www.scriptfeeds.com/thank-you/' );
                
                }
             
            }        
}

You can any number custom thank you pages by changing product ID and URL repeating code below in above code.

if ( $item['product_id'] == 1555 ) {
                    // change below to the URL that you want to send your customer to
                     wp_redirect( 'https://www.abc.com/thank-you/' );
                
                }

Use the code and let us know how it works.

Happy Coding!

[caldera_form id=”CF60ca2e3ccf64f”]

Connect with Developer
Loading
Tags: custom woocommerce thank you pageWooCommerce custom thank you page without plugin
Share34Tweet21Send

Leave a Reply Cancel reply

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

I agree to the Terms & Conditions and Privacy Policy.

Scriptfeeds Blog

© 2022 Scriptfeeds

Blog Categories

  • WordPress
  • Development
  • Reviews
  • Marketing

Connect us on

No Result
View All Result
  • Blog
  • WordPress
    • Woocommerce
    • WordPress Errors
    • WordPress Plugins
  • Development
    • WordPress Themes
  • Hire us

© 2022 Scriptfeeds

This website uses cookies. By continuing to use this website you are giving consent to cookies being used. Visit our Privacy and Cookie Policy.