简体   繁体   English

从 woocommerce 中的产品数据中删除标签

[英]Remove tabs from product data in woocommerce

I need to remove the below tabs from the product data 1- 'Get more option' Tab 2- 'woocommerce tab' 3- Upsell 4- Cross-sell As shown in the screenshot https://prnt.sc/pp1oyy我需要从产品数据中删除以下选项卡 1-“获取更多选项”选项卡 2-“woocommerce 选项卡”3-追加销售 4-交叉销售 如屏幕截图所示https://prnt.sc/pp1oyy

I wrote the below function but not working我写了下面的 function 但没有工作

function remove_tab($tabs){
unset($tabs['get_more_options']); // it is to remove general tab
unset($tabs['woocommerce_tab']); // it is to remove variations tab
return($tabs);
}
add_filter('woocommerce_product_data_tabs', 'remove_tab', 10, 1);

The "Get more options" suggestions tab were added in Woocommerce 3.6 and you can disable it by either going to Woocommerce -> Settings -> Advanced -> "Woocommerce.com" and untick the checkbox "Show suggestions". Woocommerce 3.6 中添加了“获取更多选项”建议选项卡,您可以通过转到Woocommerce -> 设置 -> 高级 -> “Woocommerce.com”并取消选中“显示建议”复选框来禁用它。

Another way is to add the following code to your themes functions.php:另一种方法是将以下代码添加到您的主题函数中。php:

add_filter( 'woocommerce_allow_marketplace_suggestions', '__return_false' );

In terms of the "Woocommerce tab" - if you want to remove upsells & cross sells you can add the follow code:就“Woocommerce 标签”而言 - 如果您想删除追加销售和交叉销售,您可以添加以下代码:

function remove_tab($tabs){
    unset($tabs['linked_product']); // Removes the tab section for cross & upsells
    return($tabs);
}
add_filter('woocommerce_product_data_tabs', 'remove_tab', 10, 1);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM