我创建了一个插件,该插件具有用于订单列表的单独页面。.在外观上,它与WooCommerce的“订单列表”页面相同,但是。我无法获得订单的注释,因此我将自定义帖子类型添加到wc_order_types
此后没有列出的订单中。它显示一个空表。?
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条件解决了这个问题 function add_wc_order_types($order_types,$type){ $order_type = $order_types; if('' == $type){ $order_type[] = WC_QD_PT; } return $order_type; }
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句