Integrate Mailpoet3 checkbox in Elementor Pro Form

In this short tutorial I will show you, how to connect Mailpoet3 to your Elementor Pro Form by a subscription checkbox.

Many forms contain on the end a checkbox where you can subscribe to your newsletter. But in the actions after your Elementor form is sent, you haven’t the possibility to say „only subscribe user to Mailpoet if the checkbox is checked“. 

But you can do this with a bit of php. So put this code in your functions.php:

After that you have to change these variables:

  • NEWSLETTER: change it with the field name of the checkbox box
  • FIRST_NAME: change it with the field name of your „First name“ field
  • LAST_NAME: change it with the field name of your „Last name“ field
  • EMAIL: change it with the field name of your „Email“ field
  • LIST_ID: change it with the ID of your list where the new subscribe should be insert in – you can find the ID of the list if your hover over the list name in the WordPress Backend
 
After that every time the checkbox is checked and the form is sent, you’ve got a new subscribe (if the email which was sent, didn’t exist before in the newsletter list).

Leave a comment

Please fill out fields with *

© 2021 by Fabian Hacker