Running a WooCommerce store often means you have to cater to different types of customers – whether that’s B2B buyers, wholesale clients, retail shoppers, or premium members. Each group has unique expectations, pricing structures, and communication needs. If you send the same plain WooCommerce email to all of them, it might feel irrelevant to some customers and miss an opportunity to create stronger engagement.
So, what is the best way to make impressive WooCommerce custom emails?
With YayMail and its Conditional Logic addon, you can easily send custom WooCommerce emails that perfectly match the role of each customer. This ensures your email communication is relevant, professional, and helps build long-term relationships.
In this guide, we’ll walk you through step-by-step on how to send WooCommerce custom emails based on customer role by using YayMail.
Table of contents
Why Have to Send WooCommerce Custom Emails Based on Customer Role?
By default, WooCommerce sends the same notification emails to all customers. But we all know, customizing email marketing isn’t just about design – it’s about speaking the right language to the right audience.
So, let’s imagine that:
- Your wholesale customers want to know about bulk deals, not retail coupons.
- Your retail shoppers love a friendly thank-you note and maybe a cross-sell suggestion.
- Your premium members expect exclusive offers and loyalty rewards.
- Your B2B clients likely require professional details, such as invoices or contact information for their account managers.
Thus, by segmenting emails based on customer role, you’ll avoid sending irrelevant messages and instead deliver content that resonates and drives loyalty for your WooCommerce store.
How to Send WooCommerce Custom Email Based on Customer Role (With YayMail)
Before you begin, make sure your WordPress site has:
- WooCommerce – your online store platform.
- YayMail – WooCommerce Email Customizer (Pro version).
- YayMail Conditional Logic Add-on – to apply conditional rules based on customer roles.
- A User Role Manager plugin (such as Members by Memberpress) to create roles like b2b, wholesale, retail, and premium members.
- Code Snippets – a safe space for adding custom code to your WordPress site.
Step 1: Create and Assign Customer Roles
Think of customer roles like giving your shoppers backstage passes. Not everyone should see the same thing – your wholesalers, retail shoppers, and VIP members all deserve a unique experience.
However, by default, WooCommerce only provides users with basic roles, such as Customer, Shop Manager, or Administrator.
But what about B2B buyers? Or your Premium Members who expect the red-carpet treatment? That’s where custom roles come in.
In this article, we will install and activate the Member plugin to create more user roles. This plugin have some available roles. You can add new roles if you want, such as creating roles like Wholesale, Retail, or Premium Member.
Then, assign each role to your customers, also known as WordPress users.
Once your roles are ready, YayMail’s Conditional Logic will instantly recognize them.
Step 2: Customize Your Emails in YayMail
Now that your customer roles are ready, it’s time to design emails that feel personal and professional for each group. YayMail makes this super easy with its drag-and-drop email builder – no coding needed.
YayMail comes with 15 pre-built email templates for WordPress users to customize. For example, if you want different order confirmations for Retail and Wholesale customers, click to customize “Completed Order”.
You can customize the email to match your brand’s style. YayMail also provides powerful email blocks, a global header/footer, and some stunning patterns for users to fully customize.
Use Preview or Send Test Email to check how your WooCommerce email looks in a real inbox.
Step 3: Create and Register New Conditional Logic for Customer Role
Now that your emails are beautifully designed, it’s time to add some smart logic behind the scenes!
With YayMail Conditional Logic, you can show or hide specific email sections based on a customer’s user role, such as Wholesale, Retail, or Premium Member.
To do this, we’ll create a custom logic class and register it using the Code Snippets plugin.
On your WordPress site, navigate to add a new snippet of YayMail Conditional Logic. Name it something like: “YayMail Conditional Logic for Customer Role.”
In the Code Editor, paste the following snippet:
use YayMailAddonConditionalLogic\Abstracts\BaseConditionalLogic;
/**
* Conditional Logic: Customer Role
*/
class CustomerRoleLogic extends BaseConditionalLogic {
private static $instance;
public static function instance() {
if ( null === static::$instance ) {
static::$instance = new static();
}
return static::$instance;
}
protected function __construct() {
parent::__construct(
'customer_role', // Unique key
__( 'Customer Role', 'yaymail' ), // Shown in YayMail dropdown
'single_select' // Dropdown (choose one role)
);
}
public function get_options() {
global $wp_roles;
$options = [];
if ( ! empty( $wp_roles->roles ) ) {
foreach ( $wp_roles->roles as $role_key => $role_data ) {
$options[] = [
'label' => translate_user_role( $role_data['name'] ),
'value' => $role_key,
];
}
}
return $options;
}
public function check_logic( $args ) {
$condition = $args['condition'];
$order = $args['order']; // WC_Order object
$condition_value = $condition['value'];
// Get user ID from order
$user_id = $order->get_user_id();
if ( ! $user_id ) {
return false; // Guest order, no role
}
// Get WP_User object
$user = get_userdata( $user_id );
if ( ! $user ) {
return false;
}
// Check if customer’s role matches the chosen condition
return in_array( $condition_value, (array) $user->roles, true );
}
}
// Register with YayMail
add_action( 'yaymail_register_conditional_logics', function( $conditional_logics ) {
$conditional_logics->register( CustomerRoleLogic::instance()->get_logic_data() );
});
Click Save Changes and Activate.
And that’s it! You’ve just registered a new conditional logic class called Customer Role.
Now, you can personalize each WooCommerce email so that each type of customer sees only the information that fits them best!
Step 4: Send Stunning WooCommerce Custom Email Based on Customer Role
It’s time to put conditional logic into action inside YayMail’s drag-and-drop builder.
Back to the dashboard of YayMail, we have a Complete Ordered email template available here. For example, if we add the block “Show a 50% Order Discount banner” for Wholesale Customers, we can set the conditional logic for that block. Which means it just displays when sending the email to the Wholesale Customers.
If we add the block “standard thank-you message” for Retail Customers, we can do the same with conditional logic for that block.
Save the change, and then your WooCommerce emails are dynamic, role-based, and perfectly tailored for every type of customer your business serves.
Bonus Tip: Track and Deliver Emails Reliably with YaySMTP
Now that your custom emails look amazing and send the right message to the right people, let’s make sure they’re actually getting delivered – and opened!
That’s where YaySMTP and Email Logs comes in.
It’s the perfect companion to YayMail, helping you send and track all your WooCommerce emails reliably.
By default, WordPress sends emails using PHP mail, which can be unreliable and often lands in spam folders.
YaySMTP fixes that by connecting your store to trusted email services (like Gmail, Outlook, SendGrid, Amazon SES, and more). Every WooCommerce email – including your role-based messages from YayMail will be sent through a professional SMTP server and tracked safely.
Final Thoughts
And there you have it – your complete guide to sending WooCommerce custom emails based on customer roles using YayMail and the YayMail Conditional Logic Addon!
Now your store doesn’t have to rely on those boring, one-size-fits-all emails anymore.
Instead, you can send personalized messages that speak directly to your customers – whether they’re wholesale buyers, retail shoppers, or premium members who deserve a little extra love.
With your setup, you can:
- Greet your B2B customers with custom invoices or terms.
- Reward Premium Members with exclusive offers.
- Thank your Wholesale clients with tailored discounts.
- And keep your Retail shoppers engaged with beautiful, branded designs.
Every message now feels like it was written just for them – and that’s exactly what builds trust and loyalty over time.
So go ahead – log in to your dashboard, open YayMail, and start creating emails that not only deliver information but also spark a connection.
You’ve got the tools, the know-how, and the creativity. Now it’s time to make your emails shine!