Woocommerce-如何删除产品列表上的“添加到购物车”按钮 [英] Woocommerce - How to remove the Add to Cart Button on product listing

查看:361
本文介绍了Woocommerce-如何删除产品列表上的“添加到购物车”按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要删除产品列表页面上的添加到购物车按钮。我希望它出现的唯一位置是单个产品页面。谁能建议我在哪里可以删除它?我一直无法从文档中获得任何帮助。

I'm wanting to remove the Add to Cart Button on the product listing pages. The only place I want it to appear is the individual product page. Can anyone suggest on where I can find to remove this? I haven't been able to get any help from the documentation.

此刻,该按钮出现在每个列表下方。

At the moment the button appears under every listing.

推荐答案

我不知道如何从WooCommerce进行操作,但是使用以下代码是可能的,只需确保这些PHP代码应执行,因此,请将其放在执行某些PHP代码的PHP文件中的适当位置,最好的位置是任何wordpress插件的基础文件,在更新该插件时要小心,因为这些代码在更新后会丢失。

I don't know how to do it from WooCommerce but with following code it is possible, just make sure that these PHP code should execute, so, put it at suitable place in PHP file where some PHP codes are executing, best place would be any wordpress plugin's base file, be careful while updating that plugin as these code will get lost after updating.

add_action( 'woocommerce_after_shop_loop_item', 'remove_add_to_cart_buttons', 1 );

function remove_add_to_cart_buttons() {
    remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart' );
}

这篇关于Woocommerce-如何删除产品列表上的“添加到购物车”按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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