2017-07-18 148 views

回答

0

1添加自定義字段將被用於加售的類別。我使用高級自定義字段插件的關係字段來處理這些事情。一旦完成,在主題中添加過濾器functions.php文件

add_filter('woocommerce_product_upsell_ids', 'category_upsells', 10, 2); 
function category_upsells($upsell_ids, $product) { 
    // get the category of the product and from the category get the product ids from your custom theme 
    // set $upsell_ids to your product ids 
    return $upsell_ids; 
} 
相關問題