Affiliates plugin with woocommerce

I currently use woocommerce to run my online store.

Is it possible to track sales from an affiliate using the affiliate plugin?

    JD
    • 53 pts
      27 pts
      LEVEL 2

    Thanks.

    I hadn't looked for an alternate plugin. I was hoping to stick with wpmu.

    I guess I'll see if I can get it to work, use an alternate plugin or migrate to MarketPress.

    Thanks again!

    JD
    • 53 pts
      27 pts
      LEVEL 2

    I looked at the various affiliate plugins. I'm really trying to get this one to work with woocommerce.

    I've added a woocommerce addon with the following code...

    function affiliate_wc_record_affiliate( $order_id ) {
    
    	// Call the affiliate action
    	do_action( 'affiliate_signup' );
    
    	if(defined( 'AFFILIATEID' )) {
    		// We found an affiliate that referred this order creation - so add a meta to the order recording it
    		if (function_exists('update_post_meta')) {
    			update_post_meta( $order_id, '_affiliate_id', AFFILIATEID );
    		}
    	}
    
    }
    add_action('woocommerce_checkout_update_order_meta', 'affiliate_wc_record_affiliate');

    It definitely calls the function at the right point, just as the user clicks to pay at the checkout page.

    The debug addon is telling me that there has been a referral as well.

    It's just not recording the referral in the post meta.

    Any suggestions?

    JD
    • 53 pts
      27 pts
      LEVEL 2

    Any chance someone could please help me resolve this?!

    Once this is fixed, the Affiliates plugin will work with woocommerce and you can consider adding this to the next release :)

    Please help!

    puccino
    • 83 pts
      524 pts
      LEVEL 6

    Hi, do you have any news on your woocommerce integration ?
    I'm searching this too.

    JD
    • 53 pts
      27 pts
      LEVEL 2

    Hi Puccino

    Unfortunately no one has responded to my query so I haven't been able to progress this.

    The lastest code I am using is below.

    I have done multiple tests on this and it updates the correct order.

    The only problem is, is that the do_action( 'affiliate_signup' ) does not return the AFFILIATEID as it should. This is part of the actual plugin so I don't understand why it's not working.

    I was hoping that someone from wpmudev would assist. I'm still waiting.

    JD

    function affiliate_wc_record_affiliate( $order_id ) {
    	global $woocommerce;
    
    	// Call the affiliate action
    	do_action( 'affiliate_signup' );
    
    	if(defined( 'AFFILIATEID' )) {
    		// We found an affiliate that referred this order creation - so add a meta to the order recording it
    		if (function_exists('update_post_meta')) {
    			update_post_meta( $order_id, '_affiliate_id', AFFILIATEID );
    		}
    	}
    
    	//if ($this->debug=='yes') $this->log->add( 'affiliate', 'Affiliate record.' );
    
    }
    add_action('woocommerce_checkout_update_order_meta', 'affiliate_wc_record_affiliate');
    Mason
    • 2,100 pts
      9,660 pts
      LEVEL 27

    Hiya,

    Just re-opening this for you and pinging our lead developer @Barry so he can assist here.

    Thanks!

    Barry
    • 526 pts
      6,840 pts
      LEVEL 24

    Have you activated the affiliate debug addon so that you can see what the plugin is doing on the front end of your site?

    JD
    • 53 pts
      27 pts
      LEVEL 2

    Hi Barry

    Sorry. I didn't realise you had responded.

    Yes. I activated the affiliate debug. The debug suggests the affiliate plugin is working as expected and did recorded the affiliate referral (see screenshot).

    Also, if I was to now add items, and proceed to checkout this function is also called at the right time. Just as the order is created a new the post_meta attribute of _affiliate_id is added; however the actual affiliate id recorderd is the variable name "AFFILIATEID".

    After a big of testing, I think the do_action( 'affiliate_signup' ) is triggered however the AFFILIATEID is not being defined.

    Any thoughts?

    JD

    Barry
    • 526 pts
      6,840 pts
      LEVEL 24

    If the debug addon is showing the correct cookie has been created all the way up to the purchase page then that is very strange :/ does the domain change at any point during that last step? Or is you code called outside the browser (e.g. by cron or ipn, etc which wouldn't then be able to get the cookie details) ?

    Have to admit, at the moment those are the only two things I can think of, but will keep racking my brain.

    Mason
    • 2,100 pts
      9,660 pts
      LEVEL 27

    Hiya @puccino, I think we're still awaiting a little more feedback from @JD on this one. Are you having any issues?

    Thanks!

    puccino
    • 83 pts
      524 pts
      LEVEL 6

    Can a dev tell us if you are working on this ?
    I don't want to buy a plugin from another site....

    Timothy Bowers
    • 10,267 pts
      80,155 pts
      LEVEL 30

    I'm not sure if @Barry is currently working on this or not or what the plans are.

    So I've pinged him for more information.

    Thanks.

    Barry
    • 526 pts
      6,840 pts
      LEVEL 24

    As I have zero experience with woocommerce this is quite low down on my todo list. My priorities with affiliate integration at the moment are to complete the Pro-sites and MarketPress integrations and to get add-ons completed for the other WPMUDEV plugins (classifieds, appointments, events, etc.).

    If anyone knows more about the woocommerce code / hooks and filters than me (not difficult as I know nothing about them) then please do post and I'll be happy to direct on the affiliate side of things.

    Fadie Hany
    • 50 pts
      1 pts
      LEVEL 0

    It's been a long time since anyone has responded here but if anyone has figured this integration out it would be greatly appreciated. Thank you!

JOIN 388130 HAPPY MEMBERS

We pride ourselves on our level of customer support and responsiveness to member requests. Your WordPress experience will never be the same


Become a member

  • PayPal Partner