How to Add Subscribe Option in WooCommerce Email Notifications? Best of 2024

Add Subscribe Option in WooCommerce Email Notifications
Add Subscribe Option in WooCommerce Email Notifications

Meaningfully you want to know How to Add Subscribe/Unsubscribe Option in WooCommerce Email Notifications? We will explain you through this guide.

WooCommerce is widely popular e-commerce platform, this lets you create an e-commerce business (store), manage inventory, accept payments, and much more. It comes with almost all the functionalities that you require to open an online store. It also helps you sell products or services online from your WordPress site at a very affordable and accessible manner.

If you want to keep your WooCommerce store’s customers interested? Send out Daily newsletter. No monthly, No weekly, No wait!

However, think about it. How many newspapers have you signed up for? Say in the past few months? Okay and assume that you’ve signed up for something.

Some of the extensions include WooCommerce Email Center which is a feature-rich paid plugin that permits you to send various transaction emails to your customers on any occasion. It is a powerful extension to control the email notifications sent from your WooCommerce online store.

Consequently, do you read every newsletter that comes in your way? Also, the customers are interested in promotional offers, such as sales, or new products are being launched. And, these offers can sometimes be sent as emails.

In case of any help related to WooCommerce Setup talk to our WordPress Experts, dial +1-888-738-0846(Toll-Free).

email-newsletter-300x213

Email Notifications for WooCommerce

For your WooCommerce store, some plugins are available that you can use to send such emails. Also, you can use some standalone WordPress newsletter plugins, such as Integration plugins, or Mailpoet (that currently connected your website to an email marketing service provider) like as MailChimp which is also the most popular email marketing service providers. Also, they offer a quite easy to use interface with great tools and amazing support.

Here, MailPoet is a WooCommerce marketing plugin that easily facilitates creating newsletters in WordPress.

As a plugin is defined as a type of software that contains a group of functions that can be added to a WordPress website. They are used to provide additional functionality to your application.

However, most of these are not connected directly to your online store. And usually, add a subscription option on a registration form or checkout page only. As the WooCommerce checkout page provides users with predefined areas, that are placed in a particular order on the checkout page.

In this post, learn how to add another subtle option, such as button or form, by using that a customer can subscribe to your notification emails, using a custom plugin. Also, you can add these options to a newsletter plugin to send the custom email.

Where, the articles posted by the admin of a WordPress site are called posts.

Add Subscribe/Unsubscribe Option under Customer Account

On a customer’s account page, a subscription option can be shown using a button. So, the customers can use this button to subscribe or (unsubscribe) to your email notifications. Let’s start.

Add Subscribe/Unsubscribe Option

Consequently, you can add a button by using your own plugin, on your WooCommerce account page, just say ‘My account below’. To show such a button you have to override the WooCommerce ‘my account.php’ template.

However, you could refer ‘How to override WooCommerce templates’, for learning how you can change the template in your plugin. Where templates are those files which control how your WordPress site will be displayed on the Web. These files draw information from your WordPress MySQL database and generate the HTML code which is then sent to the web browser.

And then add the following code to the template file:

<?php if(get_user_meta($current_user->id,’wdm_subscribe’,true) == ‘no’): ?>
<p><a href=”/my-account/?wdmsubs=true” value=”subscribe” name=”subscribe” id=”wdm_subscribe”>Subscribe</a></p>
<?php else: ?>
<p><a href=”/my-account/?wdmsubs=false” value=”subscribe” name=”subscribe” id=”wdm_subscribe”>Unsubscribe</a></p>
<?php endif; ?>

Therefore, check the above code the current user has subscribed to your newsletter if not, the button value is shown as ‘Subscribe’, and ‘Unsubscribe’.

However, by using the custom meta key to track, the user has subscribed or not. And using a parameter wdmsubs, the button click is tracked.

Display Acknowledgement Message

Once a user clicks on the button and subscribes, an acknowledgment message can be displayed using the code given below. And then add the following code to your plugin

add_action( ‘wp_head’, ‘wdm_woo_subscribe’ );
function wdm_woo_subscribe()
{
if(isset($_REQUEST[‘wdmsubs’]) && $_REQUEST[‘wdmsubs’] == true)
{
update_user_meta(get_current_user_id(),’_wdm_subscribe’,’yes’);
wc_add_notice( __( ‘Yayy! You have subscribed to our email notification.’, ‘woocommerce’ ) );
}
}

Add User to List

Although, on Subscriptions, you have to add the user to your email recipient list. Also, you can use the above function to add a user to your list or maintained the list using the Newsletter plugin.

However, to add this to a newsletter plugin, you need to find a filter or hook by using that you could add a user to the subscription list. For instance, if you use MailPoet, you can use refer how to add subscribers by using your plugin, to add the user to a MailPoet subscription list.

Unsubscribe User from Default Emails

To unsubscribe the user, we have to remove from the list of email recipients. Also, to remove the user from the customer list, use the similar hook or filter.

However, the user to unsubscribe from the default WooCommerce Email
For example,

‘woocommerce_email_recipient_customer_processing_order’, you can use the following code shown as below:

 

add_filter(‘woocommerce_email_recipient_customer_processing_order’,’wdm_woo_unsubscribe_processing_order’);
function wdm_woo_unsubscribe_processing_order($recipients)
{
$recipients = explode(‘,’,$recipients);
$final_recipient = array();
foreach($recipients as $r)
{
$user = get_user_by_email( $r );
$user_id = $user -> ID;
/*Check user meta, to verify whether the user should be excluded from the recipient list or not. */
if( get_user_meta($user_id, ‘wdm_subscribe’, true) == ‘no’)
{
$final_recipient[] = $r;
}
}
$final_recipient = implode(‘,’,$final_recipient);
return $final_recipient;
}

Also, this function can be used to add a ‘unsubscribe’ link in the WooCommerce Email footer, through overriding ’email-footer.php’ template.

Conclusion

However, your newsletters or notifications can be used in the market for your products and offers. This simple notification option can be used with your own email notification plugin or for the default WooCommerce email under the user’s page.

Read carefully above steps and Add Email notification option in WooCommerce easily.

If you think it is a good option? So, tell me your thoughts in comments section below.

wp-support
Technical Support

Get help from our WordPress Technical Support team in case of any issue related to WordPress. We are having a team of well-qualified professional who will resolve your problem instantly. So dial our number +1-888-738-0846(Toll-Free).



Leave a Reply