• How to remove the product pages completely? I wish to only allow products to be purchased from the shop page, and have code already in place for adding products to the cart (which redirects to the checkout page) all from within the shop page. I have no need for the Product pages and would like to get rid of them completely. Removing links to these pages as well as generating 404 pages when users go to these permalinks in the browser. How to do this quickly and easily in Woocommerce? Is there a hook of some sort? I can not find any setting for this at all, so am curious if maybe I can alter this post type to not show on the front-end whatsoever?

    Any help is greatly appreciated!

Viewing 1 replies (of 1 total)
  • There is no setting you could use.

    I would try to remove the product page links from the shop page using these remove actions:

    remove_action( 'woocommerce_before_shop_loop_item', 'woocommerce_template_loop_product_link_open', 10);
    remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_product_link_close', 5);

    The code goes in functions.php for your child theme or you can use the “My Custom Functions” plugin.

    This code works with Storefront. If it doesn’t work with your theme, the hooks and/or priorities may be different. Look at:
    wp_content/themes/your-theme-name/woocommerce/content-product.php
    to see how your theme has done this.

    You may be able to cover the other product page links with a redirect plugin.

Viewing 1 replies (of 1 total)
  • The topic ‘How to Remove Product Pages Completely?’ is closed to new replies.