How to Turn Off Pages Showing on WooCommerce: A Beginner’s Guide
So you’ve set up your WooCommerce store, and you’re excited to start selling! But wait… you might notice some default WooCommerce pages like the “Shop,” “Cart,” “Checkout,” and “My Account” showing up in your navigation or even indexed by search engines when you don’t necessarily want them to be. Don’t worry; it’s a common issue, and you’re not alone. This guide will walk you through how to turn off pages showing on WooCommerce in a simple and effective way.
Think of it like this: imagine opening a brand new restaurant. You wouldn’t want the public to see the messy kitchen or the storage room before you’ve finished decorating and setting everything up, right? The same logic applies to your WooCommerce store. These default pages, while crucial for functionality, might need to be hidden temporarily or permanently, depending on your store’s design and your preferred user experience.
Why Turn Off Pages on WooCommerce?
There are several valid reasons why you might want to hide specific WooCommerce pages:
- Clean Navigation: Maybe you’ve built a custom navigation menu that doesn’t need the standard “Shop” page link because you prefer showcasing specific product categories directly. Hiding the default page can declutter your menu.
- Custom Checkout Flows: You might have implemented a custom checkout process using a plugin or code. In this case, you would want to hide the default WooCommerce checkout page to avoid confusion and ensure customers are directed to your optimized checkout experience.
- SEO Considerations: In rare cases, you might want to prevent a specific page from being indexed by search engines. For example, you might be making significant changes to a page and don’t want visitors to land on an incomplete version.
- Maintenance Mode: If your store is under maintenance, hiding certain pages can prevent customer frustration and ensure a smoother experience when your store is back online.
- Assign a Different Page: If you’ve created a custom product archive page (perhaps using a page builder), select that page from the dropdown. This effectively replaces the default shop page.
- Leave it Unassigned: In rare cases, if you are using a full custom product catalogue display via shortcodes, or a 3rd party plugin, you might leave this setting empty. Be very cautious with this! Leaving this empty might cause issues in the checkout flow if WooCommerce cannot find the designated Shop page. Test thoroughly after making this change!
Method 1: The “Draft” Approach (Simple and Quick)
The easiest way to prevent a page from showing is to simply set its status to “Draft.” This is a temporary solution, ideal if you want to hide a page while you’re working on it.
1. Navigate to Pages: In your WordPress dashboard, go to “Pages” -> “All Pages.”
2. Locate the Target Page: Find the WooCommerce page you want to hide (e.g., “Cart,” “Checkout,” “My Account,” “Shop”).
3. Edit the Page: Hover over the page title and click “Edit.”
4. Change the Status: In the “Publish” meta box (usually on the right side of the screen), find the “Status” option. Click “Edit.”
5. Set to Draft: Change the status from “Published” to “Draft.”
6. Update: Click “Update” to save your changes.
Important Note: While this removes the page from your website’s navigation and prevents direct access, search engines might still have indexed the page if it was previously published for a while. You’ll need to address this with a proper SEO strategy (see the section on robots.txt and `noindex` later in this article).
Method 2: Using WooCommerce Settings (Shop Page)
For the Shop page specifically, WooCommerce provides a setting to designate which page acts as the main shop archive. If you delete or unassign the Shop page, you can effectively remove the default shop loop.
1. Go to WooCommerce Settings: In your WordPress dashboard, go to “WooCommerce” -> “Settings.”
2. Navigate to Products Tab: Click on the “Products” tab.
3. Shop Page Setting: Look for the “Shop page” setting. This dropdown menu shows the page currently assigned as your Shop page.
Here’s what you can do:
Method 3: Using a Redirection Plugin (The “Redirect” trick)
Another approach is to redirect the default WooCommerce pages to another page on your site (like your homepage or a custom landing page) using a redirection plugin. This method ensures that anyone trying to access the original page will be automatically sent elsewhere.
1. Install a Redirection Plugin: There are many free and paid redirection plugins available in the WordPress Plugin Repository. Popular options include “Redirection” and “Yoast SEO” (which includes a redirection manager).
2. Configure the Redirection: After installing and activating the plugin, find its settings (usually under “Tools” or “SEO”).
3. Create a Redirect Rule: Create a rule that redirects the specific WooCommerce page URL (e.g., `/cart/`, `/checkout/`, `/my-account/`) to your desired destination page.
4. Save the Rule: Save the redirection rule.
Example: Let’s say you want to redirect the default “Cart” page (`/cart/`) to your homepage (`/`). In the Redirection plugin, you would set the “Source URL” to `/cart/` and the “Target URL” to `/`.
Method 4: Hiding Pages with Code (Advanced)
If you’re comfortable with PHP code, you can use code snippets to hide specific WooCommerce pages. Be very careful with this method, as incorrect code can break your website. Always back up your website before making code changes.
You can add the following code to your theme’s `functions.php` file (or preferably, a custom plugin):
<?php /**
if ( is_cart() ) {
wp_safe_redirect( home_url() );
exit;
}
if ( is_checkout() ) {
wp_safe_redirect( home_url() );
exit;
}
if ( is_account_page() ) {
wp_safe_redirect( home_url() );
exit;
}
}
add_action( ‘template_redirect’, ‘my_woocommerce_redirects’ );
/
* Remove shop page from navigation.
*
* @param WP_Query $query
*/
function exclude_shop_page( $query ) {
if ( ! is_admin() && $query->is_main_query() && $query->is_post_type_archive( ‘product’ ) ) {
$shop_page_id = wc_get_page_id( ‘shop’ );
$query->set( ‘post__not_in’, array( $shop_page_id ) );
}
}
add_action( ‘pre_get_posts’, ‘exclude_shop_page’ );
Explanation:
- `my_woocommerce_redirects()`: This function checks if the current page is the cart, checkout, or account page. If it is, it redirects the user to the homepage using `wp_safe_redirect()`.
- `exclude_shop_page()`: This function prevents the shop page from being included in the main query on archive pages, effectively removing it from the shop loop display.
Important: This code *redirects* the pages. It doesn’t delete them. A better approach is to combine this method with marking pages as drafts for better control.
Dealing with SEO (Search Engine Optimization)
Hiding or redirecting pages doesn’t automatically remove them from search engine indexes. You need to take extra steps to prevent search engines from indexing these pages:
- Robots.txt: You can use a `robots.txt` file to instruct search engine crawlers not to access specific pages. However, this is only a suggestion; search engines may still ignore it. Do not rely solely on robots.txt for sensitive content.
User-agent: *
Disallow: /cart/
Disallow: /checkout/
Disallow: /my-account/
- `noindex` Meta Tag: The most effective method is to add the `noindex` meta tag to the page. This tells search engines explicitly not to index the page. Many SEO plugins (like Yoast SEO, Rank Math, All in One SEO Pack) provide an easy way to add this tag to individual pages. Locate the plugin settings in the “Edit Page” screen and look for an option to set the `noindex` tag.
Real-life example: Suppose you are revamping your “My Account” page with a new design and functionality. While the changes are in progress, you should:
1. Mark the page as “Draft” (Method 1).
2. Add a `noindex` meta tag to the page using your SEO plugin.
3. Consider using a redirection plugin to redirect users accessing the “My Account” URL to a temporary “Under Construction” page.
Conclusion
Turning off pages showing on WooCommerce can be achieved through various methods, ranging from simple settings adjustments to code snippets. Choose the method that best suits your technical expertise and specific needs. Remember to consider the SEO implications and take appropriate measures to prevent unwanted pages from being indexed by search engines. By carefully managing your WooCommerce pages, you can create a cleaner, more user-friendly online shopping experience for your customers.