Automattic\WooCommerce\Internal\Admin\Orders
ListTable::do_bulk_action_mark_orders
Implements the "mark <status>" bulk action.
Method of the class: ListTable{}
Hooks from the method
Returns
Int. Number of orders modified.
Usage
// private - for code of main (parent) class only $result = $this->do_bulk_action_mark_orders( $order_ids, $new_status ): int;
- $order_ids(array) (required)
- The order IDs to change.
- $new_status(string) (required)
- The new order status.
ListTable::do_bulk_action_mark_orders() ListTable::do bulk action mark orders code WC 10.5.0
private function do_bulk_action_mark_orders( $order_ids, $new_status ): int {
$changed = 0;
// Initialize payment gateways in case order has hooked status transition actions.
WC()->payment_gateways();
foreach ( $order_ids as $id ) {
$order = wc_get_order( $id );
if ( ! $order ) {
continue;
}
$order->update_status( $new_status, __( 'Order status changed by bulk edit.', 'woocommerce' ), true );
do_action( 'woocommerce_order_edit_status', $id, $new_status ); // phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment
++$changed;
}
return $changed;
}