1. Home
  2. Knowledge Base
  3. WooCommerce Wholesale Prices Premium
  4. Backend
  5. How To Set A Different New Order Email Subject For Wholesale Orders

How To Set A Different New Order Email Subject For Wholesale Orders

By default, all of the new order emails will use the same email template for both retail and wholesale orders. Unfortunately, we don’t have the feature to override this yet.

The workaround that we can do to distinguish the retail and wholesale order on the new order email is by adding the order type in the subject line. You can do this by adding the following snippet to your child theme’s function.php

// Custom New Order Subject - Adding the Order Type in the Subject Line
add_filter('woocommerce_email_subject_new_order', 'wwpp_change_email_subject', 1, 2);
 
function wwpp_change_email_subject($subject, $order) {
 
    //getting the blogname scaping special chars for email
    $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
    $order->get_id();
    $order_type = $order->get_meta('_wwpp_wholesale_order_type'); // The Order data
 
    // creating our new subject line
    $subject = sprintf('[%s] Order # %s - %s', $order_type, $order->get_id(), $blogname);
 
    // sending our custom subject back to WooCommerce
    return $subject;
}
Was this article helpful?

Related Articles

Need Support?

Can't find the answer you're looking for?
Contact Support