Hey Guys! I read some previous posts and want to make sure I’m on the right path. I installed WP Affiliate and just need to know if I still need the following pasted in function.php. I’m assuming this will integrate EE4 with the plugin?
function espresso_track_successful_sale($payment_data){
$sale_amt = $payment_data['total_cost']; //TODO - The commission will be calculated based on this amount
$unique_transaction_id = $payment_data['txn_id']; //TODO - The unique transaction ID for reference
$email = $payment_data['email']; //TODO - Customer email for record
$referrer = $_COOKIE['ap_id'];
do_action('wp_affiliate_process_cart_commission', array("referrer" => $referrer, "sale_amt" =>$sale_amt, "txn_id"=>$unique_transaction_id, "buyer_email"=>$email));
return $payment_data;
}
add_filter('filter_hook_espresso_update_attendee_payment_data_in_db','espresso_track_successful_sale', 20);
Hi Tammy,
You can try this code instead of the EE3 version above: https://github.com/sidharrell/EE4custom/blob/master/WP_affiliate_integration.php
I haven’t tested it with WP Affiliate, but I did run some basic tests, and it looks like it should work.
Note that the transaction amount will be for the amount paid, not the sale price. It should get triggered anytime a payment is entered, but for invoice transactions, it fires when the user finalizes their registration, but the amount paid is sent as 0, since a payment has not been applied, yet.
Also, it will need to get updated to work smoothly with the upcoming 4.6 version. I’ll try to get that written and update the github page.
Viewing 3 reply threads
The support post ‘Integrating WP Affiliate with EE4’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.
Support forum for Event Espresso 3 and Event Espresso 4.