2016-12-28 81 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

相關問題