Allowing customers to opt-in to a mailing list during checkout is a smart way to grow your email marketing channel. Where the opt-in field is located during the checkout process can determine the subscription success rate. This tutorial will show you how to change the location of the subscribe field for the WooCommerce AWeber Newsletter Subscription Plugin.
You will need the following before proceeding:
- Purchase and install the AWeber Newsletter Subscription plugin.
- Access to your theme’s functions.php file.
- Some PHP knowledge.
Step 1: Choose a New WooCommerce Hook for the Subscribe at Checkout Field Location
The AWeber Newsletter Subscription options can be found by visiting the WooCommerce admin settings and clicking on the AWeber tab.
Notice that there are only a couple of options in the “Checkout location” dropdown field to control where the subscribe at checkout field is displayed on the checkout page. But what if you want to add more options?
In order to create a new option in the “Checkout location” field, two questions will need to be answered:
- What will the name of the new option be called?
- Where will the AWeber subscribe field be located on the WooCommerce Checkout page?
For this tutorial, the new option name will be called “Custom Location”. Regarding where the AWeber subscribe field will be located on the checkout page, the woocommerce_after_order_notes hook will be used. If you want to change this, Business Bloomer has put together a WooCommerce Visual Hook Guide for the checkout page that you can use as a reference. The following WooCommerce hooks are available:
woocommerce_before_checkout_form woocommerce_checkout_before_customer_details woocommerce_before_checkout_billing_form woocommerce_after_checkout_billing_form woocommerce_before_checkout_shipping_form woocommerce_after_checkout_shipping_form woocommerce_before_order_notes woocommerce_after_order_notes woocommerce_checkout_after_customer_details woocommerce_checkout_before_order_review woocommerce_review_order_before_cart_contents woocommerce_review_order_after_cart_contents woocommerce_review_order_before_shipping woocommerce_review_order_after_shipping woocommerce_review_order_before_order_total woocommerce_review_order_after_order_total woocommerce_review_order_before_payment woocommerce_review_order_before_submit woocommerce_review_order_after_submit woocommerce_review_order_after_payment woocommerce_checkout_after_order_review woocommerce_after_checkout_form
Once you have decided where you want the subscribe field to display on the checkout page, you can move on to the next step.
Step 2: Change the AWeber Subscribe at Checkout Field Location
The AWeber Newsletter Subscription plugin uses the following filter hook on its settings page for the “Checkout location” field:
wc_aweber_checkout_location_choices
The plugin also uses the following filter hook to display the AWeber subscribe field on the checkout page:
wc_aweber_checkout_locations
The PHP code snippet below will hook into the plugin to add the new option name to the “Checkout location” field and change the location of the AWeber subscribe field. Copy and paste it into your functions.php file:
NOTE: Make sure to replace the woocommerce_after_order_notes action hook on line 16 to change the location of the subscription field.
Final Thoughts: Use an Optimal Location for the AWeber Newsletter Subscription Plugin
If you are using a checkout plugin like the WooCommerce MultiStep Checkout Wizard, you may want to test which part of the checkout process yields the best subscription results. Showing the subscribe field directly under the billing section might be more intrusive to the customer. The alternative would be to place the field near the terms and conditions acceptance field.
Let us know what you think about this tutorial by leaving a comment below.
Need help? Our WooCommerce Development Service is a complete solution for new or existing WooCommerce websites, and we can help you install and configure the plugin in this tutorial. Call us at 602-633-4758 for a free consultation.