2016-12-28 77 views

回答

1

这很容易消除对某些单一产品WooCommerce标签。您可以使用CSS轻松完成此操作。每个WC产品都有一个唯一的产品ID,请检查此http://prntscr.com/dp2c79,您会发现这使用浏览器检查元素或源代码。 查找产品ID,然后使用该产品ID的“显示:无”标签。

实例:#产品-834 .tabs:;

问候,

2

可以使用专用woocommerce_product_tabs滤波器钩去掉突出部只对一些产品(在{显示无重要!}单品页):

add_filter('woocommerce_product_tabs', 'conditionaly_removing_product_tabs', 98); 
function conditionaly_removing_product_tabs($tabs) { 

    // Get the global product object 
    global $product; 

    // Get the current product ID 
    $product_id = method_exists($product, 'get_id') ? $product->get_id() : $product->id; 

    // Define HERE your targetted products IDs in this array <=== <=== <=== 
    $target_products_ids = array(123,152,162); 

    // If the current product have the same ID than one of the defined IDs in your array,… 
    // we remove the tab. 
    if(in_array($product_id, $target_products_ids)){ 

     // KEEP BELOW ONLY THE TABS YOU NEED TO REMOVE <=== <=== <=== <=== 
     unset($tabs['description']); // (Description tab) 
     unset($tabs['reviews']);  // (Reviews tab) 
     unset($tabs['additional_information']); // (Additional information tab)  
    } 

    return $tabs; 

} 

代码放在function.php文件您的活动柒的d主题(活动主题或任何插件文件)。

此代码已经过测试并可正常工作。

根据原来的WooCommerce片段:Editing product data tabs

相关问题