如何从 Wordpress 的 WooCommerce 插件中删除购物车?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21651221/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 19:28:32  来源:igfitidea点击:

How to remove shopping cart from WooCommerce plugin in Wordpress?

wordpresswoocommerce

提问by Syed

I'm using the Virtue Theme in Wordpress and have installed the WooCommerce plugin for setting up my online store. I want to remove the shopping cart function completely and instead place an order form on individual product page. Help is sought to remove the shopping cart.

我正在 Wordpress 中使用 Virtue Theme 并安装了 WooCommerce 插件来设置我的在线商店。我想完全删除购物车功能,而是在单个产品页面上放置订单。寻求帮助以移除购物车。

回答by Dhyta Wan

this is my experienced with Woocommerce about remove carts function. I added this code in functions.php in my Virtue themes.

这是我在 Woocommerce 关于删除购物车功能的经验。我在我的 Virtue 主题的 functions.php 中添加了这段代码。

remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );

remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );

remove_action( 'woocommerce_simple_add_to_cart', 'woocommerce_simple_add_to_cart', 30 );

remove_action( 'woocommerce_grouped_add_to_cart', 'woocommerce_grouped_add_to_cart', 30 );

In this WebI used that code. I Hope that's can solve your probelms. Thank you :)

这个 Web 中,我使用了该代码。我希望这可以解决您的问题。谢谢 :)

回答by ilias iliadis

Using firefox right click on the cart and open inspector. Find the css used on the right panel. Then, in modify theme, add custom css like:

使用 Firefox 右键单击​​购物车并打开检查器。找到右侧面板上使用的 css。然后,在修改主题中,添加自定义 css,如:

.woocommerce-active .site-header .site-header-cart {
  display: none !important;
}

(In the above code ?.woocommerce-active .site-header .site-header-cart? was in the right panel of "inspector". While in modify mode you can instantly see the result, so make some tries if CSS name is not the correct one.)

在上面的代码中 ?.woocommerce-active .site-header .site-header-cart? 在“检查器”的右侧面板中。在修改模式下你可以立即看到结果,所以如果 CSS 名称是不是正确的。

回答by Afrin

To remove shopping cart from WooCommerce plugin in Wordpress, select the Disable option in Menu cart:Display

要从 Wordpress 的 WooCommerce 插件中删除购物车,请选择菜单购物车中的禁用选项:显示

Go to Appearance>Customize>WooCommerce>General>Menu cart

转到外观>自定义>WooCommerce>常规>菜单购物车

enter image description here

在此处输入图片说明