Ecommerce Shopify WordPress Discussion

WooCommerce Permalinks: Rewrite Rules not generating as expected

I developed a Wordpress / WooCommerce website on two separate environments. After launching, I encountered inconsistencies between the Live and Development environments which I can not resolve. In our development environment, I left the WooCommerce "shop page" setting empty as I intended to use a page of our own design for the storefront. This worked fine at the time. At some point after going live on our web hosts' server, the "Shop page" setting was changed to match the URL of the page we built, and WooCommerce began echoing its default storefront templates at the bottom of the page we built for our store. I changed the WooCommerce "shop page" back to an empty value but instead of reverting to the previous behaviour and showing my custom shop page, this caused the page I built for our storefront to render empty - just a header and footer without even a 404 message. The slug for the page I built is "/shop". Changing the slug for the custom storefront page to "/store" allowed it to work properly. However, the client has a strong desire for a URL which reads "/shop". And yet, when I change the slug for our custom storefront page back to "/shop", WordPress only gives us a header and footer on the front-end without any content in the middle (still no 404 message.) I've tried creating a "dummy shop page" to satisfy WooCommerce's requirement for a "shop page" in WooCommerce > Settings > Products (with a slug of dummy-shop-page,) but this hasn't improved the situation with the "/shop" page I built for our storefront - the WordPress front-end still only shows that page's content if the slug for that page is "/store", even when "/shop" is not in use by any other pages, or by WooCommerce. I've tried adding flush_rewrite_rules() to our functions.php and loading it that way a couple of times, but that's the only trick I could find and to no avail.
Permalinks: Check your permalink settings in both the development and live environments. Go to Settings > Permalinks and ensure they are set up the same way on both sites. You may want to switch to a default setting (like Plain) and then back to your preferred setting to flush the rewrite rules. Flush Rewrite Rules: You've mentioned using flush_rewrite_rules(), but let's try a more comprehensive approach. You can add the following code to your theme's functions.php temporarily: php Copy code global $wp_rewrite; $wp_rewrite->flush_rules(); This should flush the rewrite rules and may resolve the issue. Remember to remove this code after you've verified its effects. Check Other Plugins/Themes: There might be conflicts with other plugins or the theme you're using. Temporarily deactivate other plugins and switch to a default WordPress theme (like Twenty Twenty-One) to see if the issue persists. If it doesn't, reactivate each plugin/theme one by one to identify the culprit. WooCommerce Template Files: Check if there are custom template files for WooCommerce in your theme directory. Sometimes, custom templates might override default behavior. Ensure that your custom templates are correctly structured and not causing conflicts. .htaccess File: Ensure that your .htaccess file is correctly configured. You can regenerate it by going to Settings > Permalinks and saving the permalink settings again. WooCommerce Settings: Double-check WooCommerce settings, especially under WooCommerce > Settings > Products > Display. Ensure that your custom shop page is selected as the Shop page. Database Check: Sometimes, issues can be related to the database. Ensure that the database structure and data are the same on both environments. You might want to export the database from your development environment and import it into your live environment. Server Cache: If your web host uses server-side caching, clear the cache to ensure that any changes take effect. WP_DEBUG: Enable WP_DEBUG in your wp-config.php file to check for any error messages. Look for any error messages related to permalinks or WooCommerce. Remember to back up your website before making significant changes, and it's always a good idea to perform these tests on a staging site first if possible.

January 27, 2024

TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.