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