Connecting WP eStore Plug-in To The WordPress Newsletter Plugin As A Autoresponder
by Yaron Elharar (@YaronElharar)
The WP eStore Comes with Only 3 built in Autoresponders AWeber, MailChimp, and GetResponse, plus a integration option.
although those are the More common ones you might want to connect your own autoresponder For me it was the WordPress plug-in “Newsletter” which is one of the more popular ones.
To connect WP eStore to Newsletter In a way that each time a sale is processed, or newsletter registration occurs you will need to connect the two.
Prerequisites to do that are
- A child Theme
- functions.php file in that theme
Once you have both of these, add these lines of code to your child theme Functions.php file.
<?php
add_action('eStore_item_specific_autoresponder_signup', 'my_estore_custom_signup');
function my_estore_custom_signup($signup_data)
{
eStore_payment_debug('Received request for item specific autoresponder signup action.', true);
$firstname = $signup_data['firstname'];
$lastname = $signup_data['lastname'];
$email2 = $signup_data['email'];
$list_name = $signup_data['list_name'];
eStore_payment_debug('"'.$email2.'" "'.$firstname.'" "'.$lastname.'" "'.$list_name.'"', true);
// Turn this name into number
if ($list_name == "**List name**") {
$list_num = "2";
} else if ($list_name == "**List name**") {
$list_num = "3";
}
eStore_payment_debug('"'.$list_num.'"', true);
TNP::add_subscriber(['email'=> $email2, 'api_key'=>'**YOUR API KEY**', 'name'=> $firstname, 'surname'=> $lastname,'lists' => [1,$list_num]]);
}
To check if the process worked perform any purchase action in wp eStore, once the action was successfully completes, you should see a new subscriber in your subscribers list.