【发布时间】:2019-05-15 17:00:50
【问题描述】:
我使用以下代码添加了自定义 WooCommerce 状态并希望
function register_shipped_status() {
register_post_status( 'wc-shipped', array(
'label' => 'Shipped',
'public' => true,
'exclude_from_search' => false,
'show_in_admin_all_list' => true,
'show_in_admin_status_list' => true,
'label_count' => _n_noop( 'Versendet <span class="count">(%s)</span>', 'Versendet <span class="count">(%s)</span>' )
) );
}
add_action( 'init', 'register_shipped_status' );
function add_shipped_to_order_statuses( $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-shipped'] = 'Versendet';
}
}
return $new_order_statuses;
}
add_filter( 'wc_order_statuses', 'add_shipped_to_order_statuses' );
这工作正常。 WooCommerce 状态是可选择的,但我希望订单列表中的操作按钮“已完成”。
看截图:
有没有办法将此 WooCommerce 按钮添加到具有我的自定义 WooCommerce 状态的所有订单?
【问题讨论】:
标签: php wordpress woocommerce hook-woocommerce orders