我正在寻求有关如何在用户结账后将WooCommerce挂钩与我的订单状态结合使用的建议 . 我创建了自定义订单状态,并希望订单根据用户在结帐时输入的运送状态自动转到该状态 .

例如:用户来自PA - >订单状态自动设置为“东海岸”

下面的代码是我用于创建新订单状态的代码

/** 
 * Register East Coast status
**/
function register_processing_newtown_square_status() {
register_post_status( 'wc-processing-ec', array(
    'label'                     => 'Processing East Coast',
    'public'                    => true,
    'exclude_from_search'       => false,
    'show_in_admin_all_list'    => true,
    'show_in_admin_status_list' => true,
    'label_count'               => _n_noop( 'Processing East Coast <span class="count">(%s)</span>', 'Processing East Coast <span class="count">(%s)</span>' )
    ) );
}
add_action( 'init', 'register_processing_east_coast_status' );

// Add to list of WC Order statuses
function add_register_processing_east_coast_status( $order_statuses ) {

$new_order_statuses = array();

// add new order status after processing
foreach ( $order_statuses as $key => $status ) {

    $new_order_statuses[ $key ] = $status;

    if ( 'wc-processing' === $key ) {
        $new_order_statuses['wc-processing-ec'] = 'Processing East Coast';
    }
}

return $new_order_statuses;
}
add_filter( 'wc_order_statuses', 'add_register_processing_east_coast_status' );

任何人都可以给我任何关于使用WooCommerce钩子获取购物车中的用户状态信息并在结账时将其链接到此订单状态的任何见解?

http://docs.woothemes.com/document/hooks/