How To Add WooCommerce Redirect After Checkout

As a WooCommerce store owner, you may want to enhance the post-checkout experience for your customers by adding a redirect to a specific page. In this blog post, we will guide you through the process of creating a child theme using an online child theme generator and adding custom code to implement a WooCommerce redirect after checkout. By following these steps, you can easily customize your online store’s checkout process and provide a seamless user experience.

Step 1: Generate A Child Theme

Generate a Child Theme To begin, navigate to online child theme generator that simplifies the process of creating a child theme. Enter your parent theme’s name and details, such as the theme author, version, and website. Customize the options as needed, and click on the “Create Child Theme” button.

Step 2: Access the Child Theme’s Functions.php File

After uploading the child theme, log in to your WordPress dashboard and navigate to “Appearance” > “Theme Editor.” On the right-hand side, you will see a list of theme files. Locate and select the functions.php file of your child theme. This is where you will add the custom code.

add_action( 'woocommerce_thankyou', 'websensepro_redirectcustom');
function websensepro_redirectcustom( $order_id ){
    $order = wc_get_order( $order_id );
    $url = '';
    if ( ! $order->has_status( 'failed' ) ) {
        wp_safe_redirect( $url );

Make sure to replace ‘‘ with the actual URL of the page you want to redirect your customers to.

5/5 - (4 votes)


Leave a Comment

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