Why My WooCommerce Order Emails Lost Order Items in Email Previews and the Template Hook Patch That Restored Accurate Summaries

As an eCommerce entrepreneur relying heavily on WooCommerce, one of the biggest assets is the seamless processing of orders—especially how effectively those order confirmations and status updates get communicated via email. These emails are essential not just for order tracking but also for accuracy in operational workflows, such as packaging and fulfillment. However, when I recently noticed that the order confirmation emails were missing item details in preview mode, it signaled a serious breakdown in communication and trust with my customers. This article documents that issue, the root causes I uncovered, and how a strategic patch to the email template hooks restored full item visibility in email summaries.

TL;DR

WooCommerce order emails were missing product line items in previews due to a misconfiguration in how email content is rendered using hooks. Specifically, the woocommerce_email_order_items hook was inadvertently bypassed in certain preview contexts. By modifying the template behavior with correct hook attachments and conditional loading, I restored full item visibility across all email views. If your customers or team can’t see ordered products in emails, this guide will help you fix it quickly and efficiently.

The Problem: Missing Ordered Items In Email Previews

It all began when a customer support agent flagged me about confusion in order confirmation email contents. On further inspection, I discovered the customer emails showed their order total, shipping, and customer info—but none of the actual products ordered. More troubling was that when previewed from WooCommerce’s backend using tools like WP Mail Logging or Email Template Customizer, the item section appeared completely blank.

This was not just a cosmetic glitch. Here’s why it matters:

  • Reduced customer trust: Clients expect confirmation of each product they paid for. Missing items imply something’s gone wrong.
  • Operational delays: Fulfillment teams relying on emails for picking lists encounter needless bottlenecks.
  • Debugging complexity: Since the issue didn’t appear across all deliveries, pinpointing the root cause was quite technical.

Initially, I suspected plugin conflicts or caching issues. But turning off all non-core plugins and switching to a default theme yielded the same failure in item rendering—especially in the preview environment. That’s when I turned to testing the hook execution logic behind the email templates themselves.

Behind the Curtain: Hook Logic in WooCommerce Email Templates

WooCommerce uses a flexible system of hooks and templates to dynamically inject content into its emails. The product list in order emails depends heavily on the woocommerce_email_order_items hook. This hook is responsible for pulling each item from the $order object and looping through it using either PHP or prebuilt templates like email-order-items.php.

Unfortunately, WooCommerce email previews don’t always run this hook as expected. This can occur due to:

  • Changes in how a plugin or theme overrides email templates
  • Failure in conditional checks specific to email contexts (e.g., triggers not firing because it’s a preview and not a live send)
  • Custom functions misplacing the hook priority or incorrectly removing actions

In my case, it turned out that an overzealous child theme was trying to simplify email structures for mobile optimization. While intending to streamline layout, it removed several core action calls—including the one linked to the order items display.

The Fix: Patching the Template Hook Logic

The solution revolved around restoring the predictable execution of the product display logic—but only doing so with awareness of both live emails and previews. Here are the core steps I followed that fixed the problem:

  1. Audited theme overrides: Looked into yourtheme/woocommerce/emails/ to see if critical blocks such as email-order-items.php were overridden. If so, I verified that the correct hooks were still called.
  2. Hook restoration in functions.php: Re-inserted the removed do_action( 'woocommerce_email_order_items' ) line inside the appropriate email template or through an action hook added within functions.php.
  3. Conditional logic for previews: Added guards to ensure email previews also execute the same logic paths as production sends. An example PHP hook fix looked like this:
    
    add_action( 'woocommerce_email_order_details', 'restore_order_item_hook', 10, 4 );
    function restore_order_item_hook( $order, $sent_to_admin, $plain_text, $email ) {
        if ( is_a( $email, 'WC_Email' ) ) {
            wc_get_template( 
                'emails/email-order-items.php',
                array(
                    'order' => $order,
                    'items' => $order->get_items(),
                    'sent_to_admin' => $sent_to_admin,
                    'plain_text' => $plain_text,
                    'email' => $email
                )
            );
        }
    }
        
  4. Validated with previews & live emails: Used both developer logging tools and customer test orders to confirm that order items now appeared in both previews and real-world email deliveries.

This approach restored the missing product lines precisely where they belonged.

Lessons Learned: Reliable Template Management is Crucial

Through all this, several key lessons emerged that I now treat as best practices when customizing WooCommerce email behavior:

  • Keep overrides minimal and well-documented. Customizing templates is powerful, but it should always be version-controlled and clearly commented.
  • Know your hooks and their contexts. Hooks like woocommerce_email_order_items behave differently in admin previews vs. customer live sends. You need to test both scenarios.
  • Don’t disconnect your previews from your production logic. Developing a preview page or test email functionality should mimic your live send logic as closely as possible.

Another additional tip worth noting: if you’re using third-party plugins like Email Customizer for WooCommerce or MailPoet, always verify their integration points. Some of these tools completely bypass native WooCommerce hooks in favor of drag-and-drop interfaces, which can conflict with embedded PHP logic unless properly configured.

woocommerce plugins

Conclusion: Restored Trust Through Technical Precision

While it started as a subtle visual bug in email previews, this issue had real implications across both UX and backend workflows. Missing order item data breaks the confidence triangle between your store, fulfillment team, and customer—and is easy to overlook until it’s too late. Fortunately, with a meticulous approach to tracking and restoring template hooks, I was able to resolve the issue and even optimize the rendering logic for greater modularity in the future.

If you’re dealing with WooCommerce order emails that don’t include item details—especially during preview or testing—you’re likely facing the same hook misfire issue. Use this article as a checklist to diagnose faulty email logic, patch the relevant template or action call, and regain fully informative email communications across your eCommerce operations.

Remember, WooCommerce is only as powerful as your configuration allows it to be. And email templates, though often overlooked, are one of the most crucial components that deserve your careful attention.