2017-07-18 143 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; 
} 
相关问题