?v=random_string in URL
-
Hello,
I understand that ?v=random_string is related to WooCommerce -> Settings -> General -> Default customer location.
But i wonder why the ?v=random_string is added to all pages even if they are not woo pages?The page I need help with: [log in to see the link]
-
Hi @docjojo,
In WordPress, the
vparameter in the URL, such as?v=66e10e9ff65e, is typically used by themes or plugins to handle versioning or prevent caching issues. This is especially common with dynamically generated or updated CSS and JavaScript files.It’s not exclusive to WooCommerce, so it seems a plugin may have added it to your site’s URL. Could you share your system status report by going to WooCommerce > Status > Get Report, then copying and sharing it using https://gist.github.com or pastebin.com? This will help me better understand your setup.
It is woo related.
If I switch to geolocate, the ?v= is gone.
https://fastturn.net/Question is, why is ?v= added on contact page an other pages that are not woo related, even main page / get’s ?v= added.
In code it says:public static function geolocation_ajax_redirect() { if ( 'geolocation_ajax' === get_option( 'woocommerce_default_customer_address' ) && ! is_checkout() && ! is_cart() && ! is_account_page() && ! wp_doing_ajax() && empty( $_POST ) ) { // WPCS: CSRF ok, input var ok.so what can i do to prevent woo from adding ?v= to pages that are not woo related?
Hi there!
Sorry for the confusion, You’re correct that the?v=random_stringparameter is related to WooCommerce → Settings → General → Default Customer Location, specifically when “Geolocate (with page caching support)” is enabled.This parameter is added to help serve cached pages with the correct currency and tax settings based on the customer’s location.
To remove that string, I suggest setting the Default Customer Location to Geolocate instead of Geolocate (with page caching support). Once you select Geolocate, the?v=random_stringwill automatically be removed.
If you want to use the Geolocate (with page caching support) option and remove the string from the URL, you will need to apply a customization. Please note that we do not provide support for customizations.
If you need more in-depth support or want to consider professional assistance for customization, I can recommend WooExperts and Codeable.io as options for getting professional help. Alternatively, you can also ask your development questions in the WooCommerce Community Slack as custom code falls outside our usual scope of support
Let me know how that goes.Thank you.
But that does not answer my question, why is woo adding this string and the geo cookie on pages that have no product, cart or any other woo component, like the contact or privacy page.
Woo should only add the ?v= string if the page contains any woo content.Hi @docjojo,
Apologies for the earlier confusion.
The reason WooCommerce adds the
?v=random_stringparameter and the geo cookie to all pages, even those without WooCommerce content, is because the geolocation setting applies site-wide. When “Geolocate (with page caching support)” is enabled, WooCommerce appends the?v=parameter to ensure that the correct tax and currency settings are applied for each visitor based on their location.Since caching affects the entire site, WooCommerce does this globally to avoid inconsistencies, even on pages that don’t directly contain WooCommerce elements. If you’d prefer this behavior to be limited to WooCommerce pages, switching to “Geolocate” instead of “Geolocate (with page caching support)” should help.
I see, i think that is a drawback, as the woo_geo_hash function also includes the customer object which unnecessarily slows down things, plus it is implement with safe_redirect which results in a 307 redirect, which means another request to the server.
I am writing a page cache plugin and it is really hard to support woo product pages with geo based tax.caching with geo enabled is renders useless because
1) 307 redirect is an additional request, thus super slow
2) cached page are relative to country, or if a registered user, relative to user, which means several pages in cache for the same product page.
caching without geo means
1) cached page is quasi static, thus will not show the correct tax price
2) cached page will not response to cart or geo cookieSo, i really have no idea to handle this, except completely excluding woo pages
Is there any ideas, advice, recommendation about how to do page caching with woo?Hello docjojo,
Thank you for your reply.
I understand your question about WooCommerce’s geo-based tax calculation and page caching.
I recommend posting this question at Woo Community Slack.
There are many WooCommerce developers and merchants available there who might be able to help you develop a custom plugin.Let me know if you have any other questions.
Best regards.
Thank you.
The topic ‘?v=random_string in URL’ is closed to new replies.