注册新的WooCommerce订单状态

// Register new status
function register_in_progress_order_status() {
    register_post_status( 'wc-in-progress', array(
        'label'                     => 'In progress',
        'public'                    => true,
        'show_in_admin_status_list' => true,
        'show_in_admin_all_list'    => true,
        'exclude_from_search'       => false,
        'label_count'               => _n_noop( 'In progress (%s)', 'In progress (%s)' )
    ) );
}
// Add custom status to order status list
function add_in_progress_to_order_statuses( $order_statuses ) {
    $new_order_statuses = array();
    foreach ( $order_statuses as $key => $status ) {
        $new_order_statuses[ $key ] = $status;
        if ( 'wc-processing' === $key ) {
            $new_order_statuses['wc-in-progress'] = 'In progress';
        }
    }
    return $new_order_statuses;
}
add_action( 'init', 'register_in_progress_order_status' );
add_filter( 'wc_order_statuses', 'add_in_progress_to_order_statuses' );
© 版权声明
THE END
喜欢就支持一下吧
点赞2 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称常用语 夸夸
夸夸
还有吗!没看够!
表情代码图片

    暂无评论内容