Adding Custom Messages to Customer Refund Order Emails in WooCommerce WordPress

In this tutorial, we will guide you through the process of adding custom messages to customer refund order emails in your WooCommerce WordPress website. This customization allows you to provide personalized messages to customers when their orders are refunded.

Introduction

When managing an online store, providing a seamless and personalized customer experience is crucial. One way to enhance this experience is by adding custom messages to refund order emails. This can help you convey important information or offers to customers when they receive their refund confirmation. In this tutorial, we'll show you how to achieve this using WordPress and WooCommerce.

Prerequisites

Before you begin, ensure you have the following prerequisites:

  • A WordPress website with WooCommerce installed.
  • Admin access to your WordPress dashboard.

Step 1: Installing the WPCode Plugin

To add custom messages to customer refund order emails, we'll use the WPCode plugin. Follow these steps to install and activate it:

  1. In your WordPress dashboard, navigate to "Plugins" on the left sidebar.
  2. Click on "Add New."
  3. Search for "WPCode" in the search bar.
  4. Install and activate the "WPCode - Insert, Edit, and Foot" plugin.

Step 2: Creating a Custom Snippet

After activating the WPCode plugin, you can add custom code snippets to your website. Here's how:

  1. In the WordPress dashboard, find "Code Snippet" in the left sidebar under the WPCode plugin section.

  2. Click on "Add Snippet."



  3. Fill in the details for your custom snippet:

    • Title: Enter a title for your snippet.
    • Code Type: Choose "PHP snippet."
    • Code: Insert the following code:




    add_action( 'woocommerce_email_before_order_table', 'wtwh_add_content_specific_email', 20, 4 );

    function wtwh_add_content_specific_email( $order, $sent_to_admin, $plain_text, $email ) {

       if ( $email->id == 'customer_completed_order' ) {

         echo '<h2 class="email-upsell-title">Customer Completed Order</h2><p class="email-upsell-p">Add Custom Message on Customer Completed Order.</p>';

       }

    }

  4. For additional customization of the title and text, you can apply CSS using the class email-upsell-title and email-upsell.

  5. For the "Insert Method," choose "Auto insert."

  6. Set the "Location" to "Run everywhere."

  7. Activate the snippet by toggling the switch to "Active."

  8. Click "Save Snippet" to create and save the custom message.



Step 3: Updating the Order Status

To trigger the custom message, follow these steps:

  1. Go to the "Orders" page in your WooCommerce dashboard.

  2. Open any order with the "Order Status" set to "Cancel."

  3. Edit the order, and in the order details section, change the "Order Status" to "Refund."

  4. Click "Update" to save the order status change.

Step 4: Checking the Custom Message

To confirm that the custom message is working, check your email:

  1. Go to your email inbox and look for the refund order email.

  2. You should see the custom message you added, confirming that the order has been refunded.

Conclusion

Customizing refund order emails in WooCommerce can enhance the communication between your online store and customers. By following this tutorial, you can easily add personalized messages to these emails, providing a better customer experience and potentially increasing customer engagement.

Feel free to modify the title and text of the custom message according to your specific requirements. Experiment with different CSS styles to further customize the appearance of the message to match your website's branding.

That's it! You've successfully added custom messages to customer refund order emails in WooCommerce WordPress.

Previous Post Next Post