Support

Home Forums Event Espresso Premium Integrating WP Affiliate with EE4

Integrating WP Affiliate with EE4

Posted: December 26, 2014 at 2:53 pm

Viewing 3 reply threads


b2995

December 26, 2014 at 2:53 pm

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);


Josh

  • Support Staff

December 30, 2014 at 9:51 am

Hi Tammy,

The code that you posted is for Event Espresso 3’s integration with WP Affiliate. There currently isn’t an integration with WP Affiliate and EE4.


b2995

December 30, 2014 at 12:46 pm

Hi Josh! Are there any programs that you can recommend for EE4 or possibly a work-around?


Sidney Harrell

December 31, 2014 at 11:33 am

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.

Event Espresso