How to change WooCommerce Base URL?
-
Hello, we would like to change the base WooCommerce URL for our staging site, when using WooCommerce features like checkout, from?https://workshops.writetheworld.org/checkout/ (using production site base URL)?to?https://staging-[redacted]-writetheworldworkshops.wpcomstaging.com/checkout (using staging site base URL). Do you know how we could do this in our settings? thank you!?
-
This topic was modified 1 week, 1 day ago by
laurenceli.
-
This topic was modified 1 week, 1 day ago by
-
Hey @laurenceli,
Not really sure what are you trying to achieve, but WooCommerce always adds the page name after the domain name.
WooCommerce creates the following new pages:
/shop , /cart , /checkout , /my-account , /refund_returns
You may read more here: https://woocommerce.com/document/woocommerce-pages/Kind regards,
AljeHi there!
Just to clarify, are you trying to replace the live site URL with the staging site URL for WooCommerce pages temporarily on the staging site, or are you experiencing an issue where WooCommerce is still using the production URL instead of the staging one?
If it’s the latter, when you create a staging site, the URLs should automatically update to reflect the staging environment. However, if WooCommerce features like checkout are still using the production URL, it could be due to cached settings, hardcoded URLs, or database references that haven’t been updated. could you please check Settings → General on the staging site to see if the WordPress Address (URL) and Site Address (URL) are set correctly?
Also, could you please let us know which plugin or hosting tool you used to create the staging site? Some staging solutions automatically replace URLs, while others require manual updates.
If the staging URL is not appearing as expected, you may also want to check with the plugin or hosting provider to see if any additional steps are needed to update WooCommerce URLs.
Thank youHi Shahzeen, thank you for the help! The latter (WooCommerce is still using the production URL instead of the staging one) is indeed our issue. We experienced the same issue with Elementor, but Elementor allowed us to change the base URL in the plugin settings.
I confirmed on Settings → General that WordPress Address (URL) and Site Address (URL) are set correctly to the staging URL.
We host on wordpress.com, and used the base staging tool they had there.
I checked with WooCommerce, but they told me to find the answer to my query on the forums ??
Hi there!
I can understand your concern, To clarify, WooCommerce itself does not have a dedicated setting to manually change the site URL within the plugin, as it relies on the URLs defined at the WordPress level (which you’ve already adjusted).
By default you can only change the checkout endpoints by going to woocommerce → Settings → Advance here you will see checkout endpoint settings.
However, In order to replace the product site url with the stgaing site url you can try to use the search and replace plugin and try to check links on staging site see if that work for you.
https://www.ads-software.com/plugins/better-search-replace/
If that does not help, and If you 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 supportGreat, thank you! I was able to install BSR and found that in the staging site, there were 7 instances of staging URL use in __wp_woocommerce_sessions. Could a simple find/replace of finding https://workshops.writetheworld.org/ in the table and replace it with https://staging-5077-writetheworldworkshops.wpcomstaging.com/ work, or are there additional steps? Also, please let me know if there’s other tables besides those with “woocommerce” in their name that I should search in.
Here’s the place in the staging environment source code I notice the production URL still being used:
<div class="xoo-wsc-ft-buttons-cont">
<a href="#" class="xoo-wsc-ft-btn xoo-wsc-btn button btn xoo-wsc-cart-close xoo-wsc-ft-btn-continue">Continue Shopping</a><a href="https://workshops.writetheworld.org/cart/" class="xoo-wsc-ft-btn xoo-wsc-btn button btn xoo-wsc-ft-btn-cart">View Cart</a><a href="https://workshops.writetheworld.org/checkout/" class="xoo-wsc-ft-btn xoo-wsc-btn button btn xoo-wsc-ft-btn-checkout">Checkout</a></div>What’s interesting is that one of our script mentions the correct staging checkout URL:
<script type="text/javascript" id="elementor-pro-frontend-js-before">/* <![CDATA[ */var ElementorProFrontendConfig = {"ajaxurl":"https:\/\/staging-5077-writetheworldworkshops.wpcomstaging.com\/wp-admin\/admin-ajax.php","nonce":"0dad6b1a06","urls":{"assets":"https:\/\/staging-5077-writetheworldworkshops.wpcomstaging.com\/wp-content\/plugins\/elementor-pro\/assets\/","rest":"https:\/\/staging-5077-writetheworldworkshops.wpcomstaging.com\/wp-json\/"},"settings":{"lazy_load_background_images":true},"popup":{"hasPopUps":true},"shareButtonsNetworks":{"facebook":{"title":"Facebook","has_counter":true},"twitter":{"title":"Twitter"},"linkedin":{"title":"LinkedIn","has_counter":true},"pinterest":{"title":"Pinterest","has_counter":true},"reddit":{"title":"Reddit","has_counter":true},"vk":{"title":"VK","has_counter":true},"odnoklassniki":{"title":"OK","has_counter":true},"tumblr":{"title":"Tumblr"},"digg":{"title":"Digg"},"skype":{"title":"Skype"},"stumbleupon":{"title":"StumbleUpon","has_counter":true},"mix":{"title":"Mix"},"telegram":{"title":"Telegram"},"pocket":{"title":"Pocket","has_counter":true},"xing":{"title":"XING","has_counter":true},"whatsapp":{"title":"WhatsApp"},"email":{"title":"Email"},"print":{"title":"Print"},"x-twitter":{"title":"X"},"threads":{"title":"Threads"}},"woocommerce":{"menu_cart":{"cart_page_url":"https:\/\/staging-5077-writetheworldworkshops.wpcomstaging.com\/cart\/","checkout_page_url":"https:\/\/staging-5077-writetheworldworkshops.wpcomstaging.com\/checkout\/","fragments_nonce":"dee93c20e5"}},"facebook_sdk":{"lang":"en_US","app_id":""},"lottie":{"defaultAnimationUrl":"https:\/\/staging-5077-writetheworldworkshops.wpcomstaging.com\/wp-content\/plugins\/elementor-pro\/modules\/lottie\/assets\/animations\/default.json"}};/* ]]> */</script>
Hello laurenceli,
Thank you for your reply.
According to our support policy, we cannot assist you with site customizations.
As suggested previously, please consult a professional developer. You can find a good developer at Codeable.io or WooExperts.I appreciate your cooperation.
Best regards.
looks like better search replace works. Thanks all!
- You must be logged in to reply to this topic.