如何禁用/隐藏woocommerce单个产品页面? [英] How to disable/hide woocommerce single product page?

查看:26
本文介绍了如何禁用/隐藏woocommerce单个产品页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在我的 wordpress-woocommerce 网站上隐藏单个产品详细信息页面.如何在不破坏 woocommerce 功能的情况下实现这一目标?

I am trying to hide the single product detail page on my wordpress-woocommerce site. How can i achieve this without breaking woocommerce functionality?

推荐答案

您可以删除在商店页面上生成的锚点,该锚点永远不会将用户重定向到单个页面.为此,您必须将此代码粘贴到您的 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.

remove_action( 
  'woocommerce_before_shop_loop_item',
  'woocommerce_template_loop_product_link_open',
  10
);

此代码将删除链接,但在此之后,您还必须删除锚点结束标记,并且不会破坏您的 html

This code will remove link but, after that you've to remove anchor closing tag as well just it doesn't break your html

remove_action(
  'woocommerce_after_shop_loop_item',
  'woocommerce_template_loop_product_link_close',
  5
);

这篇关于如何禁用/隐藏woocommerce单个产品页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆