Replying to Avatar Kontext

Web developers / Wordpress experts / Code wizards! I need help with the following issue: WooCommerce referral links only trigger on 2nd visit.

25k sats + lifetime Gold membership on SATOSH.EE and my eternal gratitude to whoever helps me solve the problem.

I’m running into an issue with referral links on a WooCommerce site (WordPress + WooRewards paid version + Referral Codes (WooRewards and Referral Codes are LongWatchStudio plugins); also tested with the Affiliates plugin - the issue also occurred with that one). The goal is to establish referral bonds between users for a loyalty/affiliate program.

The problem:

Referral logic only triggers on the second visit to a referral URL.

On first visit, cookies for tracking (e.g., lwsadmsession…) either don’t appear or the plugin code never runs.

Reloading the same link triggers the referral logic as expected.

This behavior occurs with multiple referral plugins, not just WooRewards.

What I’ve tried:

Disabled all other plugins, switched to default theme

Cloudflare + Rocket.net: disabled query string caching

.htaccess rules to bypass server caching

Early hook code to force session/logic execution (relied on ChatGPT to come up with those codes, would not be surprised if they were faulty in and of themselves)

Verified no Varnish or server-level caching interference

Developer insight from WooRewards:

“Our code is never called. Something else takes charge before WordPress, and (even if unintentional) fakes our redirection.”

Looking for ideas why referral plugin code isn’t executing on first visit, even when cookies or sessions should be available.

Happy to provide more details, just drop a comment or email me kontext@satosh.ee

Thanks!

#asknostr #devs #wordpress #woocommerce #bounty

25k sats + a lifetime membership upgrade at nostr:nprofile1qyd8wumn8ghj7cn0wd68ytnvv43hgatjd9n8jtnwv46z7qg4waehxw309a5xjum59ehx7um5wghxcctwvsqzqr5g4trndr2lykpyx7pxqs4nlvazdgfx70v9wcvvddn99204h7s27tcduj still up for grabs to whoever can find me a working solution:

The issue seems to be that referral cookie attempts to set too late, after WooCommerce sessions have started or headers have been sent. On first visit, no session exists → cookie cannot be set → referral only works on second visit.

What I've tried to do is - launch referral logic at the earliest hooks - many times (even before posting this problem here) with different code snippets from ChatGPT, Claude, now also Lumo and Duck.ai (which, admittedly, also uses ChatGPT) but none of the solutions work. The end result is still the same.

#asknostr #wordpress #woocommerce #devs

nostr:nevent1qvzqqqqqqypzqqn3uxu6m9lr790dws3j03ww5dynh4nzsps3vw9h5rmw9zkcelusqyt8wumn8ghj7etyv4hzumn0wd68ytnvv9hxgtcpzemhxue69uhks6tnwshxummnw3ezumrpdejz7qgswaehxw309ahx7tnnw3ezucmj9uqzptp5jayaqmpfrf98yxnlfqew5hxe2f0dpt0xm4yrqveslpenregda7xxuf

Reply to this note

Please Login to reply.

Discussion

No replies yet.