Automattic\WooCommerce\Internal\Admin\Orders
ListTable::do_bulk_action_mark_orders
Implements the "mark <status>" bulk action.
Метод класса: ListTable{}
Хуки из метода
Возвращает
int. Number of orders modified.
Использование
// private - только в коде основоного (родительского) класса $result = $this->do_bulk_action_mark_orders( $order_ids, $new_status ): int;
- $order_ids(массив) (обязательный)
- The order IDs to change.
- $new_status(строка) (обязательный)
- The new order status.
Код ListTable::do_bulk_action_mark_orders() ListTable::do bulk action mark orders WC 11.0.1
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;
}