Affiliates pro user registration and woocommerce integration problem

Posted in

Hi itthinx team!

I’m approaching you with a very specific case that I have. (And I appologise for the long post in advance!)

I’m currently developing a custom solution for my business where I need to allow Affiliate partners to register customers.

To achieve this I developed a form, which will appear in their Affiliate Area. This form will allow them to register new customers and select from a list of products (WooCommerce Subscription products) that the customer would like to purchase.

Upon submitting the form I’m programmatically creating the WordPress user for the new customer and I’m creating an Order and Subscription with the selected products, using the WooCommerce API.
I’m also attaching the newly registered customer to a specific group, using your Groups plugin and I’m adding an Affiliate Permanent equal to the ID of the Affiliate that is currently logged in and it’s registering the customer.

The problem that I have is that a Referral record is not being created for the Affiliate neither when I create the order programmatically or when the subscription renewal is triggered.

I’m using your Affiliates PRO product alongside the Affiliates Permanent, Groups and the WooCommerce Integration (not WooCommerce light).

The key settings that I have are the following:
– Recurring Referrals: Enabled (Limit/Timeout = 0)
– Enable the user registration integration: Enabled
– Enable the WooCommerce customer registration integration: Enabled
– Commision Method: Rates
– Auto-referrals: Enabled
* Affiliates Permanent
– Assign new customers to the referring affiliate. WooCommerce is required for this option: Enabled
– Assign users to the referring affiliate upon first referral. The assignment will be made if no accepted or closed referrals are on record for the user yet : Enabled

I also have Rates set up and assigned the WooCommerce integration there. I also specified that the Rate should apply only to a specific Group (which the Affiliate that registers the Customer belongs to).

I enabled the WP_DEBUG mode to check for any potential errors, but the log doesn’t show anything wrong with the plugin or my implementation.

Can you please advise on what might be the potential problem here, or if the thing I want to achieve is possible at all?

Thanks in advance!

5 Responses to Affiliates pro user registration and woocommerce integration problem

  1. George June 25, 2019 at 1:34 pm #

    I’m glad I could help Rudek, hope your implementation works as expected!

    Cheers,
    George

  2. George June 23, 2019 at 5:15 pm #

    Hey Rudy,

    In general, both options have to do with referrals related to new user/customer signups. If you choose to only grant commissions on sales, then you won’t need them.
    In your case since we are talking about a custom implementation, if you really need to use them then it would be better to have a look at your implementation.

    Kind regards,
    George

    • Rudek June 24, 2019 at 7:05 am #

      Thank you, George!

      You’ve been really helpful and you gave me the insight that I needed on how to work with the plugin .

      Best,
      Rudy

  3. Rudek June 21, 2019 at 6:23 am #

    Hi George,

    Thank you for the answer. With a bit of further reading through the source, as you recommended I ended up using directy the Affiliates_WooCommerce_Integration::process_order method after I created the order. From what I see so far things seems to work now. The ‘woocommerce_checkout_order_processed’ hook needs to be triggered for the referral to get stored with the correct rates automatically, but I coundn’t find a way to let WC trigger it itself, without going through the regular Checkout process like an end user.

    Do I need these two options:
    – Enable the user registration integration: Enabled
    – Enable the WooCommerce customer registration integration: Enabled

    in order to achieve the result I want, or since I’ll be triggering the Affiliates_WooCommerce_Integration::process_order method manually I can go without them?
    I’m asking this, because if I have these enabled, I end up with a referral with 0 amount , no currency and post_id equal to the page_id of the custom form that I have and I think this is redundant.

    Thanks,
    Rudy

  4. George June 20, 2019 at 12:13 pm #

    Hi Rudek,

    Thanks for using our plugin and for detailed post.

    Although I haven’t seen your implementation I would assume that the WC hooks for new order are not triggered when you create a new order programmatically. I would recommend you to have a look at Affiliates WooCommerce integration source code and probably if you use the method Affiliates_WooCommerce_Integration::process_order( $order_id, $affiliate_ids ) you will be able to store the referral. There are two other methods regarding subscription renewals woocommerce_subscriptions_renewal_order_created or wcs_renewal_order_created in the same class depending on which WC Subscriptions plugin version you are using.

    Hope it helps.

    Kind regards,
    George

We use cookies to optimize your experience on our site and assume you're OK with that if you stay.
OK, hide this message.

Affiliates · Contact · Jobs · Terms & Conditions · Privacy Policy · Documentation · Downloads · Useful Plugins · My Account

Share