Automattic\WooCommerce\Internal\Admin\Orders

ListTable::bulk_action_notices()publicWC 1.0

Show confirmation message that order status changed for number of orders.

{} Это метод класса: ListTable{}

Хуков нет.

Возвращает

null. Ничего.

Использование

$ListTable = new ListTable();
$ListTable->bulk_action_notices();

Код ListTable::bulk_action_notices() WC 6.9.4

public function bulk_action_notices() {
	if ( empty( $_REQUEST['bulk_action'] ) ) {
		return;
	}

	$order_statuses = wc_get_order_statuses();
	$number         = absint( $_REQUEST['changed'] ?? 0 );
	$bulk_action    = wc_clean( wp_unslash( $_REQUEST['bulk_action'] ) );

	// Check if any status changes happened.
	foreach ( $order_statuses as $slug => $name ) {
		if ( 'marked_' . str_replace( 'wc-', '', $slug ) === $bulk_action ) { // WPCS: input var ok, CSRF ok.
			/* translators: %s: orders count */
			$message = sprintf( _n( '%s order status changed.', '%s order statuses changed.', $number, 'woocommerce' ), number_format_i18n( $number ) );
			echo '<div class="updated"><p>' . esc_html( $message ) . '</p></div>';
			break;
		}
	}

	if ( 'removed_personal_data' === $bulk_action ) { // WPCS: input var ok, CSRF ok.
		/* translators: %s: orders count */
		$message = sprintf( _n( 'Removed personal data from %s order.', 'Removed personal data from %s orders.', $number, 'woocommerce' ), number_format_i18n( $number ) );
		echo '<div class="updated"><p>' . esc_html( $message ) . '</p></div>';
	}
}