WooCommerce Subscribe To Emails Checkbox On Checkout

WooCommerce subscribe to emails checkbox on checkout form


There are no pre-requisites in order for you to be able to implement this solution.

How To Implement This Solution?

Simply copy the pre-coded solution to your active theme’s functions.php or preferably the Code Snippets Plugin.

About this Solution

Asking users to subscribe to your emails on the checkout page is the perfect place to begin remarketing your store and products to advocates. A paying customer doesn’t need as much convincing to buy a product if they’ve already done it before, so by contacting them by email, your chances of turning them into another sale are far greater. This quick guide shows you how you can get users to opt-in to emails on the checkout page without an intrusive popup which we see far too often. If a user does subscribe and checkout, you’ll see in the order editor that the meta will be updated to show whether they have subscribed (checked the box) or not.

* Snippet Name: Add a custom email subscription checkbox field to the WooCommerce checkout form.
* Snippet Author: ecommercehints.com

add_action( 'woocommerce_after_order_notes', 'ecommercehints_custom_email_subscription_checkbox_field' );
add_action( 'woocommerce_checkout_update_order_meta', 'ecommercehints_save_subscription_input' );

function ecommercehints_custom_email_subscription_checkbox_field( $checkout ) {
woocommerce_form_field( 'subscribed', array(
'type' => 'checkbox',
'class' => array('form-row-wide'),
'label' => 'Subscribe To Emails?',
), $checkout->get_value( 'subscribed' ) );

function ecommercehints_save_subscription_input( $order_id ){
if( !empty( $_POST['subscribed'] ) && $_POST['subscribed'] == 1 ) {
update_post_meta( $order_id, 'subscribed', Yes );
} else {
update_post_meta( $order_id, 'subscribed', No );

How to see if a customer subscribed?

Simply head to the order editor in the dasboard and scroll down to where the order meta is shown, as displayed in this image:

WooCommerce order editor showing custom saved order meta

Snippet Benefits

  • Capture whether users opt-in for emails at the checkout.
  • Increase the size of your email audience by capturing consent at the last stage of the sales funnel.
WooCommerce Conversion Rate Optimisation (CRO) eBook
100 WooCommerce Conversion Rate Optimisation Tips

Leave a Reply

If you are going to write code in the comments, please wrap it between code tags.

Your email address will not be published. Required fields are marked *

Other Recent Guides

Subscribe To Emails

Get exclusive WooCommerce tips that I only share with email subscribers

Join hundreds of other subscribers