Multiple Checkout Option Links Not Referencing Correct Option

We offer membership via twelve currencies.
On the Membership Options Page each currency has its own Option (eg. /?s2p-option=8). This means the correct currency option is visible on the dropdown to make it simpler for the potential member.
It used to work very well, but now, only works if you’re logged-in (which, of course, potential members will not be - unless they are upgrading).

Just to clarify - if you click a currency whose link ends in /?s2p-option=8 - and you are NOT logged-in. The checkout page opens with the Default (option 1) visible. If you happen to be logged-in, checkout displays the correct currency (option 8).

Any help with this will be greatly appreciated,
Andy

That’s an odd behavior… I tried it in my tests installation, and it worked fine even as a guest. Could it be something related to your setup? Maybe something in the .htaccess?

:slight_smile:

Hello Cristián,
Thanks for your reply.

I’m pretty dim when it comes to .htacess :see_no_evil: I wouldn’t really know what I’m looking for.
Most of it is Yoast Redirects at the moment, and then there’s this stuff (below). It includes some s2Member text…

I just created a Staging copy of the site, and as soon as I have access to it (it sometimes takes a while to “propagate” apparently) I will try deactivating all the plugins (apart from s2Member of course) and I’ll delete the .htaccess (temporarily) too

    # HTTPS forced by SG-Optimizer
<IfModule mod_rewrite.c>
	RewriteEngine On
	
	RewriteCond %{HTTP:X-Forwarded-Proto} !https
	RewriteCond %{HTTPS} off
	RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
# END HTTPS

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# BEGIN s2Member GZIP exclusions
<IfModule rewrite_module>
	RewriteEngine On
	RewriteBase /
	RewriteCond %{QUERY_STRING} (^|\?|&)s2member_file_download\=.+ [OR]
	RewriteCond %{QUERY_STRING} (^|\?|&)no-gzip\=1
	RewriteRule .* - [E=no-gzip:1]
</IfModule>
# END s2Member GZIP exclusions

# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
	RewriteEngine On
	RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
	RewriteBase /
	RewriteRule ^index\.php$ - [L]
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteCond %{REQUEST_FILENAME} !-d
	RewriteRule . /index.php [L]
</IfModule>

# END WordPress
# SGO Unset Vary
Header unset Vary
# SGO Unset Vary END
AddHandler application/x-httpd-php74 .php .php5 .php4 .php3

I’ll report back with my findings.
Andy

1 Like

Cool! Let me know how it goes with those tests.

I guess that if the .htaccess is working for logged in users, then it’s not the source of the issue for logged out ones…

My next suspect would be caching. Logged in users are normally not served a cached page because it can be different for each user. But guests would usually get a cache of the page, and the caching plugin may be ignoring the querystring in the URL…

So a simpler test to try is disabling cache for a moment and try to reproduce the problem with that page. If that’s it, then go about configuring the cache so that it works correctly.

:slight_smile:

Hello Cristián,

Thank you for your help with this.

On a staging copy, I deactivated all plugins apart from s2Member, then tried on a browser as a visitor. No change…

I emptied (and disabled) every cache I’m aware of, including a plugin, and settings on the server. No change.

I deleted all redirects, and most of the content on the .htaccess file - leaving just s2Member and Wordpress. No change.

The url is correct on the Membership Options page buttons, but the “?s2p-option=4” is missing in the Checkout page address bar…

Tearing my hair out with this at the moment. If I could find how to edit the Checkout form labels, it would help (I’d like to include a hint to encourage people to use the dropdown to access the options.).

Andy

Tearing my hair out with this at the moment

I understand what you mean, heh…

If you let me take a look directly, I could try helping you. I’d need admin access to the staging one. You can send it by email to support at wpshraks.com with a link to this thread.

:slight_smile:

Just confirming the staging is set up, and I emailed you with login details.

Thanks. Got it. I’m in.

Nice formatting of the shortcodes! All looks fine there. I updated the custom value’s domain so that it’s valid in the staging site. On this site I could reproduce the behavior you mentioned: works as expected when logged in, but not as a guest.

Is it okay for me to make edits to one of the pages, and add a plugin to try figuring it out? I’d like to install a PHP execution plugin to output values on the page to help me see if the s2p-option form the URL makes it to s2Member when I look at it as a guest.

:slight_smile:

Yes, of course!
Do what you like with the staging copy! I won’t touch it until you’ve finished.

Good luck!

Thanks!

I did some basic troubleshooting first, before going into the variables thing. Deactivated all other plugins and then the problem went away. Then reactivated and tested after each, and found that activating Yoast brought the behavior back.

You can take it from there with them. It’s probably some setting that you need to tweak.

:slight_smile:

That’s peculiar!
I disabled all the plugins apart from s2Member, and it made no difference!
I’ll try it on the live site.
Thanks Cristián.

Yup!
Definitely working with Yoast disabled.
I’m on to them now.

1 Like

OH - THIS IS FUN!

Quote from Yoast:
Yoast’s canonical redirects automatically modify URLs behind the scenes to help with SEO by pointing to a “preferred” version of a page. However, this default behavior can sometimes unintentionally remove important query parameters like s2p-option.”

It’s outrageous that they change the content of a site without the owner’s permission. What’s happening in the world?

1 Like

Interesting!

But there must be a way to whitelist that page, at least…

Googled a bit about it and found a couple of results that could help you:

https://wordpress.stackexchange.com/questions/275071/url-is-redirecting-301-when-query-string-is-passed-through-url

https://stackoverflow.com/questions/60716178/how-to-disable-yoast-seo-in-specific-page

:slight_smile:

Thanks Cristián,
I’ve told them to make it optional, or I’ll opt to go elsewhere!
We are PAYING them good money to BUTCHER our content!
At the moment they are not suggesting any workaround.

I’ll certainly study the links you sent though - many thanks!
Andy

1 Like

Thank you for your help with this, Cristián.
In case it’s of benefit to anyone else, I finally managed to extract from Yoast that this feature CAN be disabled as follows:
Yoast SEO > Settings > Advanced> Advanced: URL cleanup .
That string isn’t EXACTLY what I see on my Mac, but it’s pretty close.
You can disable ALL “unregistered URL parameters”, or specify which link endings you want to exclude.

1 Like

Thank you for the update, Andy! I’m glad you could sort it out! :smiley: