Support » Plugin: WooCommerce » How to hide/disable single product page

  • Resolved sylviazeng

    (@sylviazeng)


    Hi,
    I am trying to build a e-commerce web with wordpress + woocommerce. But I don’t need single product pages. I just want a shop page.
    I found the code on the internet and pasted it on the function.php file of my child theme.

    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 );

    And the whole theme looked like this now:

    <?php
    add_action( ‘wp_enqueue_scripts’, ‘themify_shoppe_child_enqueue_styles’ );
    function themify_shoppe_child_enqueue_styles() {
    wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’ );
    }
    ?>
    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 );

    But it didn’t work. I tried to paste the code both inside and outside of ?>. But didn’t work, too.

    Any advice or help? Thanks a lot!

Viewing 1 replies (of 1 total)
  • Plugin Support Fernando

    (@fhaps)

    Automattic Happiness Engineer

    Hi @sylviazeng,

    Note that what the code will do is remove the links to the single product pages. So, that when customers click on a product in the shop page, they aren’t taken to a different page. However, if someone has a direct link to the product page, that will still exist.

    You’d need to set up custom redirects or permissions to completely wipe out traces of the product pages. Seems like this might be a good place to start: https://stackoverflow.com/questions/44197739/how-to-disable-hide-woocommerce-single-product-page

    Hopefully that helps!

Viewing 1 replies (of 1 total)
  • The topic ‘How to hide/disable single product page’ is closed to new replies.