相关疑难解决方法(0)

在Admin Dashboard Stats Widget中添加自定义订单状态

我想在WooCommerce Admin Dashboard Stats小部件中包含自定义订单状态的详细信息.我已经设置了2个自定义订单状态wc-processing.

成功付款后的订单流程为:
wc-processing => wc-awaiting-shipment=> wc-dispatched=> wc-completed.

由于awaiting shipmentdispatched是定制订单状态,WooCommerce统计插件是不是反映了总销售金额的订单.问题是我有许多订单wc-dispatchedwc-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)

php wordpress dashboard orders woocommerce

4
推荐指数
1
解决办法
1309
查看次数

标签 统计

dashboard ×1

orders ×1

php ×1

woocommerce ×1

wordpress ×1