我想在WooCommerce Admin Dashboard Stats小部件中包含自定义订单状态的详细信息.我已经设置了2个自定义订单状态wc-processing.
成功付款后的订单流程为:
wc-processing=>wc-awaiting-shipment=>wc-dispatched=>wc-completed.
由于awaiting shipment和dispatched是定制订单状态,WooCommerce统计插件是不是反映了总销售金额的订单.问题是我有许多订单wc-dispatched和wc-awaiting-shipment状态.
这是我用来注册这个自定义订单状态的代码:
/**
* Register new status
* Tutorial: http://www.sellwithwp.com/woocommerce-custom-order-status-2/
* */
function register_awaiting_shipment_order_status() {
register_post_status('wc-awaiting-shipment', array(
'label' => 'Awaiting Shipment',
'public' => true,
'exclude_from_search' => false,
'show_in_admin_all_list' => true,
'show_in_admin_status_list' => true,
'label_count' => _n_noop('Awaiting shipment <span class="count">(%s)</span>', 'Awaiting shipment <span class="count">(%s)</span>')
));
}
add_action('init', 'register_awaiting_shipment_order_status');
// Add to list of WC Order statuses
function …Run Code Online (Sandbox Code Playgroud)