Convergent Trading Posted April 7, 2022 Posted April 7, 2022 Hello, I think I may have identified a situation where referrers are not attributed during checkout. Prerequisites.. * Nexus set to "Force users to make a purchase when registering?". * Using Stripe gateway. * Have referrals configured Issue (I think?)... In Core, Referrals are logged and through an "onCreateAccount" MemberSync hook. It looks for the "referred_by" cookie in the request. However when using Stripe, our member accounts are created during the webhook request from Stripe - so the customers cookie is not present in the request, and the referral is not logged for the member. I have some logging running during the "onCreateAccount" hook for one of my own extensions, so you can see the backtrace of the request that creates the account from Stripe (and therefore doesn't have the referred_by cookie). Going through the checkout code I also see there's some logic to store the "referred_by" in the "guest_data" field on an invoice, but I don't see that stored in our database and I don't see any code that looks at that field to apply the referral via that route anyway (but maybe it worked this way in the past??) Would really appreciate your help looking in to this! Thanks!
Marc Posted April 8, 2022 Posted April 8, 2022 It may well be this is a bug, but I have tagged our developers so they can advise for certain on this. If it is we can get it logged for resolving in a future release
Convergent Trading Posted April 20, 2022 Author Posted April 20, 2022 Hi @Marc Stridgen, was anyone able to look in to this issue?
Stuart Silvester Posted April 20, 2022 Posted April 20, 2022 Hi, I'm sorry I missed this. It does sound like a bug so I've created an internal report to look further into it.
Convergent Trading Posted May 10, 2022 Author Posted May 10, 2022 @Stuart Silvester thanks Stuart, did anyone get a chance to look at this issue?
Marc Posted May 11, 2022 Posted May 11, 2022 There is still a bug report outstanding on this at present
Solution Marc Posted August 8, 2022 Solution Posted August 8, 2022 This has been resolved in the recently released 4.7..1 version of the platform. Please upgrade to that version if you are experiencing this issue, and if you still have any problems, please let us know. SeNioR- 1
Convergent Trading Posted August 9, 2022 Author Posted August 9, 2022 Thanks, I will apply the update and test it out.
Convergent Trading Posted August 9, 2022 Author Posted August 9, 2022 @Marc Stridgen this issue is still present for us. I think the idea in your code is to save the "reffered_by" key to the "guest_data" of the invoice, when i test this and check the invoice in the database there's only a "guestTransactionKey" value... no other fields So i've looked in to why this might be and it's in file /applications/nexus/sources/Invoice/Invoice.php line 1609. Function createAccountForGuest() overwrites this data and doesn't keep the referred_by key - it throws it out and therefore it's not applied later. I have replaced this code with something like the following and can confirm this fixes the problem. If you can apply this fix/similar upstream that would be greatly appreciated, then we can start using this feature! Around line 1609, replace... $this->guest_data = isset( $this->guest_data['guestTransactionKey'] ) ? array( 'guestTransactionKey' => $this->guest_data['guestTransactionKey'] ) : NULL; with... $guest_data = array(); if (isset( $this->guest_data['referred_by'] )) { $guest_data['referred_by'] = $this->guest_data['referred_by']; } if (isset( $this->guest_data['guestTransactionKey'] )) { $guest_data['guestTransactionKey'] = $this->guest_data['guestTransactionKey']; } $this->guest_data = \count($guest_data) ? $guest_data : NULL;
Marc Posted August 10, 2022 Posted August 10, 2022 I have flagged a developer for this to see if we can get that looked at
Convergent Trading Posted August 10, 2022 Author Posted August 10, 2022 (edited) Thanks, thinking about the fix I posted, this code kinda stinks in general because it's not future proof for other values that might get added, so maybe better to keep the whole array and just remove the items that have been dealt with in that function... but obviously your call :-) Edited August 10, 2022 by Convergent Trading
Andy Millne Posted September 6, 2022 Posted September 6, 2022 Thanks @Convergent Trading I have submitted a fix for this for inclusion with a future release. Convergent Trading 1
Recommended Posts