• Hi,

    I’ve been playing around with this plugin and really like it, however I’m running into an issue when trying to integrate any kind of affiliate plugin.

    The issue is that no commissions are being generated for recurring payments. The first initial payment tracks fine, but the recurring ones do not.

    I’ve tried the following plugins, neither of which have tracked recurring commissions:

    1. WP Affiliate Manager (using this integration: https://wpaffiliatemanager.com/affiliates-manager-paid-memberships-pro-integration/)

    2. PMPro Lightweight Affiliate Tracking (https://www.paidmembershipspro.com/add-ons/plugins-on-github/pmpro-lightweight-affiliate-tracking/)

    I’m using stripe (test keys) and the recurring payment is daily (this is for testing purposes so I do not have to wait a month to see if the commission was assigned).

    As the PMPro Lightweight plugin was written by the developers for paid memberships pro I thought it should work as github would suggest recurring payments are supported? Possible bug?

    When I debugged the integration for WP Affiliate Manager I noticed that the $morders variable in the pmpro_add_order hook was set to 1, and none of the parameters used in the script had been set.

    Any ideas?

    Thanks!

    https://www.ads-software.com/plugins/paid-memberships-pro/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter djt99

    (@djt99)

    I’ve been looking into this again, and think the problem is that the total attribute is not present in the Member Order object.

    The integration code uses $morder->total:

    function wpa_pmpro_add_order($morder)
    {
    	if(!empty($morder->total))
    	{
    		$sale_amt = $morder->total; //TODO - The commission will be calculated based on this amount
    		$unique_transaction_id = $morder->code; //TODO - The unique transaction ID for reference
    		$muser = get_userdata($morder->user_id);
    		$email = $muser->user_email; //TODO - Customer email for record
    
    		//need to get the last order before this
    		$last_order = new MemberOrder();
    		$last_order->getLastMemberOrder($morder->user_id);
    
    		if(!empty($last_order->affiliate_id))
    		{
    			//perform
    			$referrer = $last_order->affiliate_id;			
    
    			do_action('wp_affiliate_process_cart_commission', array("referrer" => $referrer, "sale_amt" =>$sale_amt, "txn_id"=>$unique_transaction_id, "buyer_email"=>$email));
    
    			//update the affiliate id for this order
    			global $wpa_pmpro_affiliate_id;
    			$wpa_pmpro_affiliate_id = $referrer;
    		}
    	}
    }
    add_action("pmpro_add_order", "wpa_pmpro_add_order");

    However, the relevant paidmembershipspro code uses a local $total variable rather than $this->total, as seen here: https://github.com/strangerstudios/paid-memberships-pro/blob/v1.7.8.1/classes/class.memberorder.php#L471

    Therefore the total is never passed to the pmpro_add_order hook, meaning recurring commissions are never triggered.

    Can anyone confirm this issue?

    No, that’s not it. Line 359 of that class already put the value of $this->total into $total.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Recurring affiliate commissions are not being tracked.’ is closed to new replies.