How To Update Woocommerce Follow Up Emails On WordPress Manually

How to Update WooCommerce Follow-Up Emails on WordPress Manually (For Beginners)

WooCommerce follow-up emails are a fantastic way to boost sales, build customer loyalty, and improve your overall customer experience. They allow you to automatically send targeted emails based on specific customer actions like abandoned carts, completed purchases, or even product reviews. While many WooCommerce plugins simplify the process, sometimes you need to get your hands dirty and update these emails manually. This guide will walk you through the process, step-by-step, even if you’re a complete beginner.

Imagine this: A customer adds a product to their cart, gets distracted, and never completes the purchase. A well-crafted abandoned cart email can be the gentle nudge they need to come back and finalize their order. Or, after a customer receives their product, a follow-up email asking for a review can provide valuable social proof for your store.

Why Update Follow-Up Emails Manually?

You might be wondering why bother with manual updates when plugins exist. Here are a few compelling reasons:

    • Customization Beyond Plugin Limits: Plugins often have limitations. Manual updates allow you to implement highly specific personalization or integrate with custom features you’ve developed.
    • Troubleshooting and Debugging: Understanding the underlying code helps you diagnose and fix issues that plugins might mask.
    • Learning and Understanding: Manual updates offer a deeper understanding of how WooCommerce and WordPress work, empowering you to become a more proficient user.
    • Legacy Systems and Compatibility: Sometimes, older WooCommerce versions or custom setups might require manual adjustments for follow-up emails.

    Prerequisite: Access Your WordPress Files

    Before we begin, you’ll need access to your WordPress files. This typically involves one of these methods:

    • FTP (File Transfer Protocol): A program like FileZilla connects to your website’s server, allowing you to upload, download, and edit files.
    • cPanel File Manager: Most web hosting providers offer a cPanel with a File Manager, providing a web-based interface for managing your files.

    Important: Always back up your website before making any manual changes to your files. This will protect you in case something goes wrong.

    Step 1: Locating the WooCommerce Email Templates

    WooCommerce uses template files to generate its emails. These templates are located within the WooCommerce plugin directory. However, it’s strongly recommended NOT to directly edit these core files. Instead, we’ll create an “override” in your theme’s folder.

    Here’s the recommended process:

    1. Find the Template: Navigate to the WooCommerce plugin directory: `wp-content/plugins/woocommerce/templates/emails/`.

    2. Identify the Email Template: Look for the specific email template you want to modify. For example:

    • `customer-processing-order.php`: Email sent when an order is being processed.
    • `customer-completed-order.php`: Email sent when an order is completed.
    • `customer-invoice.php`: Email sent with the invoice.
    • 3. Copy the template: Copy the template to your theme folder

      4. Create the directory: Make sure that in your theme there is a directory like this `your-theme/woocommerce/emails/` if is it does’t exists, create it.

      5. Paste the template: Paste the copied template to this directory.

    Step 2: Editing the Email Template

    Now that you have the email template within your theme, you can safely edit it. Open the file using a text editor like Notepad++, Sublime Text, or Visual Studio Code.

    Example: Modifying the “Order Complete” Email

    Let’s say you want to add a personalized message and a coupon code to the “Order Complete” email. Here’s how you might modify `your-theme/woocommerce/emails/customer-completed-order.php`:

    <?php
    /**
    
  • Customer completed order email
  • * This template can be overridden by copying it to yourtheme/woocommerce/emails/customer-completed-order.php.
  • * HOWEVER, on occasion WooCommerce will need to update template files and you
  • (the theme developer) will need to copy the new files to your theme to
  • maintain compatibility. We try to do this as little as possible, but it does
  • happen. When this occurs the version of the template file will be bumped and
  • the readme will list any important changes.
  • * @see https://docs.woocommerce.com/document/template-structure/
  • @package WooCommerceTemplatesEmails
  • @version 3.7.0
  • */

    defined( ‘ABSPATH’ ) || exit;

    /*

    * @hooked WC_Emails::email_header() Output the email header

    */

    do_action( ‘woocommerce_email_header’, $email_heading, $email ); ?>

    get_billing_first_name() ) ); ?>

    <?php

    /*

    * @hooked WC_Emails::order_details() Shows the order details table.

    * @hooked WC_Emails::order_schema_markup() Adds schema markup.

    */

    do_action( ‘woocommerce_email_order_details’, $order, $sent_to_admin, $plain_text, $email );

    /*

    * @hooked WC_Emails::order_meta() Shows order meta data.

    */

    do_action( ‘woocommerce_email_order_meta’, $order, $sent_to_admin, $plain_text, $email );

    /*

    * @hooked WC_Emails::customer_details() Shows customer details

    * @hooked WC_Emails::email_address() Shows email address

    */

    do_action( ‘woocommerce_email_customer_details’, $order, $sent_to_admin, $plain_text, $email );

    ?>

    As a thank you, here’s a special coupon code for your next purchase: WELCOME10 (10% off)

    <?php

    /*

    * @hooked WC_Emails::email_footer() Output the email footer

    */

    do_action( ‘woocommerce_email_footer’, $email );

    Explanation:

    • We added a simple `echo` statement with the personalized message and coupon code.
    • The `` is a HTML comment to help future developers understand that this code was addded.

    Important Considerations:

    • HTML and CSS: Use HTML tags for formatting and CSS for styling. You can find examples within the existing templates.
    • PHP Variables: WooCommerce provides variables (like `$order`) containing order information. Refer to WooCommerce documentation for available variables.
    • Testing: Always test your changes thoroughly before making them live. Place a test order to ensure the email renders correctly.

    Step 3: Updating Text and Subject Lines

    Subject lines and some text strings might not be directly within the template files. They are often managed through WooCommerce settings or translation files. Here’s how to access them:

    Updating Subject Lines:

    1. WooCommerce Settings: Go to WooCommerce > Settings > Emails.

    2. Manage Emails: Find the specific email you want to modify (e.g., “Completed order”) and click “Manage”.

    3. Subject Field: Edit the “Subject” field to your desired subject line.

    Updating Text Strings (Potentially requiring code):

    1. Locate the string: First find where the string is located in the file, for example: “.

    2. Edit the file: Edit the file `your-theme/woocommerce/emails/customer-completed-order.php` and find the text.

    3. Edit the text: Edit the text between `”` like this: “.

    4. Test the changes: Test the order and check that the changes are displayed correctly.

    Step 4: Testing Your Changes

    After making any changes, it’s crucial to test them thoroughly.

    • Place a Test Order: The best way is to place a test order on your website using a test payment gateway (like the WooCommerce Stripe testing mode). This will trigger the email and allow you to verify the content and formatting.
    • Check Email Rendering: View the email in various email clients (Gmail, Outlook, etc.) to ensure it displays correctly across different platforms.
    • Review Logs (if applicable): If you’re using a plugin for email logging, check the logs to see if the email was sent successfully and if there were any errors.

    Common Mistakes to Avoid

    • Editing Core WooCommerce Files Directly: As mentioned, this is a BIG NO-NO. Your changes will be overwritten during updates. Always use theme overrides.
    • Syntax Errors: PHP is sensitive to syntax. A single misplaced semicolon can break your website. Use a code editor with syntax highlighting to catch errors.
    • Ignoring Security: Be cautious when adding user input (e.g., from custom fields) to emails. Sanitize the input to prevent security vulnerabilities.
    • Not Testing: Never deploy changes without thorough testing.

Conclusion

Updating WooCommerce follow-up emails manually gives you unparalleled control over your customer communication. While plugins offer a more streamlined approach, understanding the manual process empowers you to create truly customized and effective email campaigns. Remember to back up your site, use theme overrides, and test thoroughly before deploying your changes. Good luck!

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *