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

SOLVED, TL;DR:

Rocket.net's infrastructure strips tilde characters (~) from query parameters at the server level before they reach WordPress/PHP.

This broke WooRewards (AKA MyRewards - the free version of the plugin) referral links. After months of debugging and working with their engineering team, they confirmed this is a platform limitation they cannot change. Solution: Switched hosts to Cloudways - referral links now work immediately.

What I tried (all failed on Rocket.net):

Disabled all caching (WordPress, Cloudflare, server-level)

Modified .htaccess with cache bypass rules

Created MU-plugins for early session initialization

Tested with multiple referral plugins (same issue across all)

Cookie whitelisting (only partially helped)

Definitive proof it was server-level:

Created debug logging that showed when visiting ?~=abc123&foo=bar, the URL arrived at the server but $_SERVER['QUERY_STRING'] was empty in PHP - the tilde parameter was stripped before reaching the application layer.

Lesson learned: If your referral/affiliate plugins use non-standard query parameter formats (especially tilde), verify your host doesn't filter them. Standard parameters like ?ref=CODE worked fine, but WooRewards' referral link format was incompatible with Rocket.net's infrastructure.

Working solution: Migrated to Cloudways] - both WooRewards tilde links and standard referral code plugins now function correctly on first visit.

Reply to this note

Please Login to reply.

Discussion

No replies yet.