How to Add Content to the WooCommerce Thank You Page

How to Add Content to the WooCommerce Thank You Page
On this page
  1. Why Customize the Thank You Page
  2. Step 1: Add Static Content to the Thank You Page
  3. Troubleshooting
  4. Frequently Asked Questions
  5. Conclusion

To add content to the WooCommerce Thank You page, hook a function into woocommerce_thankyou and echo your HTML — WooCommerce automatically passes the order ID into this hook, so you can also show order-specific details rather than just static text.

Why Customize the Thank You Page

  • It’s the highest-attention page in the entire checkout flow — customers are actively reading right after purchase
  • A great place for a “come back soon” coupon to encourage repeat purchases
  • Useful for cross-sells, referral program prompts, or delivery expectation notes

Step 1: Add Static Content to the Thank You Page

PHP
/** Show a return-customer offer on the order-received page */
add_action( 'woocommerce_thankyou', 'print_repeat_purchase_offer' );

function print_repeat_purchase_offer( $order_id ) {
    echo '<p>Thanks for shopping with us! Use code <strong>WELCOME10</strong> for 10% off your next order.</p>';
}
Add content to the WooCommerce thank you page: the page before adding the code
Before
Add content to the WooCommerce thank you page: the page after adding the code
After

Showing Order-Specific Content Instead

Since $order_id is available, you can load the full order object and reference actual purchase details rather than generic text:

PHP
function print_order_recap( $order_id ) {

    $order = wc_get_order( $order_id );

    if ( ! $order ) {
        return;
    }

    echo '<h3>Your Order Summary</h3><ul>';

    foreach ( $order->get_items() as $item ) {
        echo '<li>' . esc_html( $item->get_name() ) . ' × ' . esc_html( $item->get_quantity() ) . '</li>';
    }

    echo '</ul>';
}
add_action( 'woocommerce_thankyou', 'print_order_recap' );

Troubleshooting

Adding This Directly in a Page Builder Causes a 500 Error

Pasting raw PHP into a page builder’s HTML/shortcode widget on the actual Thank You page is not the right approach — it can trigger a fatal server error since most page builders don’t execute arbitrary PHP that way. Always add this kind of snippet to your child theme’s functions.php (or a snippets plugin) instead, hooked to woocommerce_thankyou.

Content Doesn’t Appear

Confirm you’re testing on an actual completed checkout, not a cached or bookmarked old order-received URL — some caching setups can serve a stale version of this page.

Frequently Asked Questions

Can I show different content depending on what was purchased?

Yes — loop through $order->get_items() and check product IDs or categories, then conditionally echo different content based on what’s in the order.

Will this content show for guest checkouts?

Yes, the woocommerce_thankyou hook fires regardless of whether the customer was logged in or checked out as a guest.

Does this affect the actual order confirmation email?

No — this only affects the on-site Thank You page. To add similar content to the confirmation email, use the separate woocommerce_email_before_order_table or woocommerce_email_after_order_table hooks instead.

Conclusion

A single hook is all it takes to add content to the WooCommerce Thank You page, whether that’s a simple coupon message or a fully dynamic order recap. Just make sure the code lives in functions.php rather than a page builder widget to avoid server errors.

See also How to Include a Custom WordPress Page on the Thank You Page.

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