WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
Disable "shop" page (3 posts)

  1. Gavrisimo
    Member
    Posted 10 months ago #

    Hello,

    while trying to disable "shop" page I did the following:

    1. deleted "shop" page in admin panel
    2. in woocommerce settings, I clicked "x" for "shop" page, so that select element is empty and saved settings
    3. tried to remove code from almost all files in "plugins/woocommerce/templates" just to see if I can get empty page

    No matter what I do "shop" page was there with it's content.

    I ended up updating woocommerce.php file in root of my theme, where I did this:

    <?php
    
    // If we are on /shop force 404
    if ( is_shop() ) {
      global $wp_query;
      $wp_query->set_404();
      status_header(404);
    
      get_template_part('404');
    } ?>

    Right now this is working, I mean, when I try to open "shop" page I really get 404.php template rendered and actual 404 status returned in network tab.

    Since this is my first theme with woocommerce support I am wandering if this is the best way to achieve the thing I need? Not sure if there is some functionality on other pages that will stop working because of "shop" page not being there.

    http://wordpress.org/plugins/woocommerce/

  2. Roy Ho
    Member
    Posted 10 months ago #

    If you remove page from the menus, it is already hidden from public so why would that not work? Unless you're afraid either someone guesses it or search enqines pick it up?

    So the ultimate question here is why are you trying to do this. Without knowing the answer to this, it is hard to suggest anything.

  3. Gavrisimo
    Member
    Posted 10 months ago #

    The client said so. I think that answers both your questions. :)

    There are different pages that lead to a product where they can add it to cart.

Reply

You must log in to post.

About this Plugin

About this Topic