I am trying to hide the single product detail page on my wordpress-woocommerce site. How can i achieve this without breaking woocommerce functionality?
相关问题
- Display product ACF field value in Woocommerce tra
- Adding a custom button after add to cart button in
- How to add a “active” class to a carousel first el
- Setting custom order statuses as valid for payment
- change the font size in tag cloud
相关文章
- wordpress新增页面如何个性化设置
- select query in wordpress
- Get WooCommerce featured products in a WP_Query
- Woocommerce update shipping methods in checkout vi
- Change order status just after payment in WooComme
- Publishing or uploading failed. Error message: “Th
- Facebook Login With WP JWT Auth
- Wordpress development process
Put it in functions.php
You can remove the anchor generated on shop page which would never redirect user to single page. For that, you've to paste this code in your functions.php file.
This code will remove link but, after that you've to remove anchor closing tag as well just it doesn't break your html
The single page is something that is provided from WordPress and there is no way to disabled it. But there some ways to prevent access to single product page.
The first one is to edit your shop (products-archive) template and to delete all the places where you have a link to the single page.
The second is to do a check on each page load if the page is a single product page and redirect the user to wherever you want:
You can include this code in your functions.php file of your child-themes directory. Have in mind that I've haven't tested the code.
You can register a hook that returns 404 in case of product pages using
is_product()
helper functionSolution is tested and working.
Note: solution was based somehow on some info from @ale's answer.