I added a custom order status to woocommerce with php in function.php.
I can see/set this status on the admin surface, but I would like to use REST API (v2 or v3) and update orders to this set this new status.
API returns this error : Error: In: status [rest_invalid_param]
I can set pre-built status for orders but not the new one. How can I do this?
Wordpress 5.2.2,WooCommerce 3.6.4
function wpblog_wc_register_post_statuses() {
register_post_status( 'wc-invoicing', array(
'label' => 'XXXX',
'public' => true,
'exclude_from_search' => false,
'show_in_admin_all_list' => true,
'show_in_admin_status_list' => true,
'label_count' => _n_noop( 'XXXX <span class="count">
(%s)</span>', 'XXXX alatt <span class="count">(%s)</span>' )
));
}
add_filter( 'init', 'wpblog_wc_register_post_statuses' );
function wpblog_wc_add_order_statuses( $order_statuses ) {
$order_statuses['wc-invoicing'] =
_x( 'XXXX alatt', 'Order Status', '' );
return $order_statuses;
}
add_filter( 'wc_order_statuses', 'wpblog_wc_add_order_statuses', 10, 1 );