使用 WooCommerce 自定义订单列表页面
我创建了一个插件,它有一个单独的订单列表页面......因为它看起来与 WooCommerce 的订单列表页面相同,但是.我无法获得订单的评论,所以我将我的自定义帖子类型添加到 wc_order_types
之后,没有列出订单......它显示了一个空表.?
I have created a plugin which has a separate page for order listing.. in that it looks like the same as WooCommerce's Order Listing page but. i am unable to get the comments of the order so i added my custom post type to wc_order_types
after that there is no order listed.. its showing a empty table. ?
add_filter( 'wc_order_types',array($this,'add_wc_order_types'),10,3);
public function add_wc_order_types($order_types,$type){
$order_types[] = WC_QD_PT;
return $order_types;
}
我通过在我的钩子函数中添加一个 if 条件解决了这个问题函数 add_wc_order_types($order_types,$type){$order_type = $order_types;if('' == $type){$order_type[] = WC_QD_PT;}返回 $order_type;}
I Solved The issue just by adding a if condition in my hook's function
function add_wc_order_types($order_types,$type){
$order_type = $order_types;
if('' == $type){
$order_type[] = WC_QD_PT;
}
return $order_type;
}