Start a Project

Custom WooCommerce and MailChimp Subscription Form

Karl – a web developer with Wibble web design Belfast
By Karl Proctor 19 October, 20185 MIN READ
Custom WooCommerce and MailChimp Subscription Form

Wibble are a well-known web design and development studio using WordPress but of late we have really increased our expertise with WooCommerce – the well known ecommerce suite. More and more of our clients are using WooCommerce and we are offering specialist support to them.

In this blog post we are showing one of the problems we resolved for a long term client of ours – BPerfect Cosmetics. This involved in-depth knowledge of WooCommerce and MailChimp.

The problem

The client needed a way to obtain the emails of users who wanted to register interest in a product. They required the emails to go into a MailChimp list, so that the users could be later contacted when the product was released. The users registering interest would also get the chance to be a part of the pre-sale, with a chance to order the product before it goes on sale for everyone.

The solution

WooCommerce and MailChimp Integration by Wibble web Design Belfast

There were a few WooCommerce hooks involved in this. MailChimp supplies the code for a form, and they even give the code for an un-styled form, so that it can be made to fit the style for the site.

A constraint that made this slightly more difficult was that it wasn’t just a email that was required, but a first name, last name and country.

The form would also need to only display on an out of stock product, so that was something to think about. 

The code required for this was straightforward. An add_action was required, using the ‘woocommerce_product_meta_start’ with a priority of 20 in this case.

The ‘woocommerce_product_meta_start’ is able to put content on the single product page, under the add-to-cart area. Another important thing was using $global product, and then wrapping the code in if(!$product->is_in_stock()) {}

Submission Form

Above, you can see the form in action, which automatically subscribes the user to the waiting list and also passes the product that they are subscribing to. This gives the client much more user information than the previous set up which only passed the email address.

At Wibble, we love solving web design and development problems for clients and above is a quick example of one that we did utilising two powerhouses of the web – WooCommerce and MailChimp.

Share this blog post

Karl – a web developer with Wibble web design Belfast

Karl Proctor

More from author