How to Display Product Upsells on the Thank You Page in WooCommerce – 2026

Last updated on July 18th, 2024 at 10:51 am

Upselling is a powerful strategy to increase your average order value by suggesting related or higher-end products to customers. One effective place to present upsells is on the Thank You page, where customers are already in a buying mindset. This guide will show you how to display product upsells on the WooCommerce Thank You page without using any plugins.

Why Display Upsells on the Thank You Page?

The Thank You page is the final step in the purchasing process, and it’s a prime opportunity to suggest additional products. Customers who have just completed a purchase are often still open to buying more, especially if they see complementary or upgraded items.

Step 1: Create a Function to Display Upsells

First, we need to create a function that will fetch and display upsell products. Add the following code to your theme’s functions.php file:

/*
 *  * Snippet: How to Display Product Upsells on the Thank You Page in WooCommerce – 2026
* Author: John Cook
* URL: https://wcsuccessacademy.com/?p=1297
* Tested with WooCommerce 10.7.0
* "Function to display upsells on thank you page"
*/ function wcsuccess_display_upsells_on_thank_you_page($order_id) { $order = wc_get_order($order_id); $upsell_products = []; foreach ($order->get_items() as $item) { $product_id = $item->get_product_id(); $product = wc_get_product($product_id); $upsells = $product->get_upsell_ids(); if (!empty($upsells)) { foreach ($upsells as $upsell_id) { $upsell_products[] = wc_get_product($upsell_id); } } } if (!empty($upsell_products)) { echo '<h2>You may also like...</h2>'; echo '<ul class="products upsells">'; foreach ($upsell_products as $upsell) { echo '<li class="product">'; echo '<a href="' . get_permalink($upsell->get_id()) . '">'; echo $upsell->get_image(); echo '<h2 class="woocommerce-loop-product__title">' . $upsell->get_name() . '</h2>'; echo '</a>'; echo '<span class="price">' . $upsell->get_price_html() . '</span>'; echo '</li>'; } echo '</ul>'; } }

This function retrieves the upsell products for each item in the order and displays them on the Thank You page.

See also  How to Hide a WooCommerce Category from Search Results - 2026

Step 2: Hook the Function to the Thank You Page

Next, we need to hook our function to the Thank You page. Add the following code to your theme’s functions.php file:

/*
 *  * Snippet: How to Display Product Upsells on the Thank You Page in WooCommerce – 2026
* Author: John Cook
* URL: https://wcsuccessacademy.com/?p=1297
* Tested with WooCommerce 10.7.0
* "Hook the upsells function to thank you page"
*/ add_action('woocommerce_thankyou', 'wcsuccess_display_upsells_on_thank_you_page');

This line ensures that our upsell display function runs when the Thank You page is rendered.

Step 3: Style the Upsells Section

To ensure the upsells section looks good on the Thank You page, add some CSS to your theme’s style.css file or the Additional CSS section in the Customiser:

/*
 *  * Snippet: How to Display Product Upsells on the Thank You Page in WooCommerce – 2026
* Author: John Cook
* URL: https://wcsuccessacademy.com/?p=1297
* Tested with WooCommerce 10.7.0
* "CSS for upsells section on thank you page"
*/ .upsells { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 30px; } .upsells .product { border: 1px solid #ddd; padding: 15px; text-align: center; width: 100%; max-width: 200px; } .upsells .product img { max-width: 100%; height: auto; } .upsells .product h2 { font-size: 1.25em; margin: 10px 0; } .upsells .product .price { font-size: 1.1em; color: #333; }

This CSS ensures that the upsells section is styled nicely and fits well with your theme.

Step 4: Test Your Changes

After adding the code and CSS, make a test purchase on your WooCommerce store to ensure the upsell products appear correctly on the Thank You page. Adjust the styling and functionality as needed to fit your store’s design and requirements.

Use Cases for Upsells on the Thank You Page

  1. Complementary Products: Suggest products that complement the items just purchased, such as accessories or related items.
  2. Higher-End Alternatives: Present upgraded versions of the purchased products, encouraging customers to consider a higher-quality option.
  3. Limited-Time Offers: Highlight special deals or limited-time offers to create a sense of urgency.
  4. Seasonal Promotions: Show seasonal or holiday-related products that customers might be interested in.
  5. Subscription Services: If you offer subscription services, suggest them as an add-on to the purchased products.
See also  How to Open WooCommerce Products in a New Tab - 2026

Conclusion

Displaying product upsells on the Thank You page in WooCommerce is a great way to increase sales and enhance the customer experience. By following the steps outlined in this guide, you can easily implement this feature without relying on plugins. Customise the upsell products and styling to match your store’s unique needs and watch your average order value grow.

0 0 votes
Article Rating

Stay In Touch

Was this post helpful? Why not show your support and buy me a coffee?

Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Scroll to Top
0
Would love your thoughts, please comment.x
()
x
×