• Hi,
    on my site, I am not using the Shop page or the Cart page as people click on the pricing table and go directly to the checkout.

    In order to remove the Shop and Cart page from the website I’ve already done the following:

    • Made the Shop, Cart & My Account Pages Private
    • From the WooCommerce settings taken out the shop, cart & my account page

    Screenshots:

    View post on imgur.com

    View post on imgur.com

    But the problem is if someone still visits the URLs manually by entering them in the browser like example.com/shop/

    The page title shows Page Not Found
    But in the body, I can clearly see the products showing up. Does anyone know a way to make sure if anyone enter /shop/ it will show them the proper 404 pages?

    If there is a code snippet to make this happen, please do share that.
    Thanks looking forward to reply.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support RK a11n

    (@riaanknoetze)

    Hi there,

    It sounds like those products are populated based on a customised 404-error page. By default, the products wouldn’t show there 🙂. Have you checked whether there are any template overrides or custom page templates being used for your site?

    Also, have you considered using a 301 redirect plugin to simply redirect users from your shop page to one of your choosing?

    Plugin Support RK a11n

    (@riaanknoetze)

    Side note: you could also add those 301 redirects using the .htaccess file on your server 🙂

    Thread Starter iSaumya

    (@isaumya)

    @riaanknoetze Sorry I didn’t understand what you said properly but let me explain based on what I understood.

    1. Ues I have a 404.php template but when someone is going to /shop beside showing the Page Not Found in the <title>...</title> tag that 404.php template is not kicking in so that it looks like any other 404 page.
    2. I have no idea how can I do a 301 redirect to show a 404 page? You see for each of the service present in the website, there is a dedicated page with pricing table and everything. So, I can’t just randomly redirect them to a service page which they might not be looking for. Showing 404 is the best approach was my site don’t have a shop or cart or my account page. This problem is only happening for the shop page. But the cart, my account is perfectly showing 404.
    3. It’s on a Nginx server so no htaccess

    My WooCommerce Overwrites:

    View post on imgur.com

    Looking forward to your reply.

    • This reply was modified 3 years, 10 months ago by iSaumya.
    Plugin Support RK a11n

    (@riaanknoetze)

    Can you share the code of your custom 404 page template?

    Unless you’ve ruled out 301 redirects entirely, there’s a free plugin that could help: https://wordpress.org/plugins/eps-301-redirects/ :

    Thread Starter iSaumya

    (@isaumya)

    @riaanknoetze,
    You can take a look at the 404.php template here: https://gist.github.com/isaumya/97d8f15cdff0e1d515e0d9063399dc0c

    Firstly I’ve ruled out the 301 as I explained before, there is no single place to redirect people who are entering the shop URL.

    Secondly, I am strictly against simply adding new third-party plugins for doing minor things unless they are absolutely necessary for the development of the website. I would rather code it myself than using a huge third party plugin to do a simple 301 redirect.

    I would rather do it either in nginx.conf or if I’m feeling too geeky, the in a Cloudflare worker maybe. 😜

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to hide Shop & Cart page?’ is closed to new replies.