Meaningfully you want to know How to Add Subscribe/Unsubscribe Option in WooCommerce Email Notifications? We will explain you through this guide.
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.
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 844 275 0975(Toll-Free).
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.
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.
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.
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.
|<?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’ );|
if(isset($_REQUEST[‘wdmsubs’]) && $_REQUEST[‘wdmsubs’] == true)
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
|‘woocommerce_email_recipient_customer_processing_order’, you can use the following code shown as below:|
Also, this function can be used to add a ‘unsubscribe’ link in the WooCommerce Email footer, through overriding ’email-footer.php’ template.
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.
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 844 275 0975(Toll-Free).