How to Display Product Upsells on the Thank You Page

How to Display Product Upsells on the Thank You Page
On this page
  1. Why the Thank You Page Is a Strong Upsell Moment
  2. Step 1: Display Chosen Products on the Thank You Page
  3. Troubleshooting
  4. Frequently Asked Questions
  5. Conclusion

You can display product upsells on the Thank You page in WooCommerce by hooking into the order-received endpoint and echoing WooCommerce’s built-in

shortcode with a chosen list of product IDs.

Why the Thank You Page Is a Strong Upsell Moment

  • The customer has just completed a purchase and trust is at its highest point
  • Unlike checkout, there’s no risk of interrupting or complicating the current transaction
  • The Thank You page isn’t a real WordPress page, so a shortcode can’t simply be pasted in — it needs a hook
  • Works well combined with related or complementary product suggestions

Step 1: Display Chosen Products on the Thank You Page

PHP
/** Show a hand-picked list of products on the Thank You page */
add_action( 'woocommerce_thankyou', 'display_upsell_products_thankyou' );

function display_upsell_products_thankyou() {
    echo '<h2>You Might Also Like</h2>';
    echo do_shortcode( '
'
);
}
Display product upsells on the thank you page: the page before adding the code
Before
Display product upsells on the thank you page: the page after adding the code
After

Troubleshooting

Products always show, even ones the customer just bought

This static list doesn’t automatically exclude items from the order — add a check against $order->get_items() and filter out matching product IDs before rendering the shortcode.

Product list looks outdated over time

Since the IDs are hardcoded, review and refresh this list periodically as your catalog changes, or build a dynamic version that pulls from a product category instead of fixed IDs.

Frequently Asked Questions

Can I show products related to what was just purchased instead of a fixed list?

Yes, pass the order ID into the callback, get the purchased product’s related product IDs, and build the shortcode’s ids attribute dynamically instead of hardcoding it.

Does this work for guest checkouts too?

Yes, the Thank You page hook fires for every completed order regardless of whether the customer was logged in or checked out as a guest.

Can I add a discount code alongside the upsell products?

Yes, echo additional HTML or a coupon code notice in the same function, right before or after the products shortcode output.

Conclusion

A single hook and WooCommerce’s own

shortcode are enough to display product upsells on the Thank You page. Since the Thank You page doesn’t accept content the normal way, remember this action-hook approach is required rather than editing a page directly.

See also How to Move WooCommerce Upsells Above the Tabs (and Change Their Number).

Prefer no code? All-in-One Utilities Woo Add-on handles this kind of change from a settings screen. Its Checkout and thank-you page content guide also shows how.

Leave a Reply

Schedule a call