Skip to main content
Cookbook WooCommerce WooCommerce

Customize WooCommerce Order Emails with AI

Add tracking numbers and branded styling to WooCommerce order emails without touching a theme file.

Difficulty Intermediate
Time ~15 min
Tools code_execute, run_wp_cli

Prerequisites

A connected WooCommerce site, and the order meta key your shipping plugin uses to store the tracking number (check its settings, or ask WPVibe to help you find it).

The prompt
Add a small, theme-independent code snippet to my WordPress site that adds shipping tracking info to WooCommerce order emails.

Here's what I have:
- Order meta key that holds the tracking number: [your tracking number meta key, e.g. _tracking_number]
- Order meta key that holds the carrier, if any: [your carrier meta key, or say "none"]
- Brand color for the highlight box: [your hex color, or say "default" for light gray]

Please:
1. Write the snippet as a must-use plugin file (not part of my active theme), so it survives theme changes and plugin updates.
2. Hook into woocommerce_email_order_meta so it shows up in both the HTML and plain-text versions of every customer order email.
3. Only show the tracking block when the order actually has a tracking number saved. Don't show an empty box.
4. Show me the exact code before you save it, and tell me the file path.
5. After saving, render a preview of the "Processing Order" email for a real order in my store so I can see the tracking block before a customer does.
6. Tell me how to remove the file to instantly undo the change if I don't like it, no theme edits required.

Already connected to WPVibe?

Skip the copy-paste. Just ask your AI for the “Customize WooCommerce Order Emails with AI” recipe, or describe the task, and WPVibe runs these steps on your own site.

WooCommerce’s default order emails are plain and generic, and the question “where’s my tracking number” shows up in your inbox anyway because the shipping details never made it into the email the customer actually reads. The usual fix is copying WooCommerce’s email template files into your theme and editing PHP by hand, which works until your theme updates and quietly overwrites the change, or a plugin update ships a template your copy no longer matches.

WPVibe writes a small, self-contained snippet instead of touching your theme or WooCommerce’s own files. It hooks into WooCommerce’s built-in woocommerce_email_order_meta action and saves as a must-use plugin, so it keeps working through theme switches and plugin updates and only shows itself when an order actually has tracking info saved. The AI shows you the exact code before it saves anything, then renders a real order email so you can see the tracking block before a customer does.

Copy the prompt below and tell WPVibe which order meta field your tracking number and carrier are stored in (check your shipping plugin’s settings if you’re not sure). It will draft the snippet, preview an order email with the change applied, and only activate it once you say go. If you ever want it gone, deleting the one file it created removes the change completely, no theme edits to revert.

Outcome

Your WooCommerce order emails include a tracking number block automatically, no plugin required.