Automattic\WooCommerce\Internal\Admin\Orders

ListTable::render_wc_actions_column()publicWC 1.0

Renders order actions.

Method of the class: ListTable{}

Return

null. Nothing.

Usage

$ListTable = new ListTable();
$ListTable->render_wc_actions_column( $order ): void;
$order(WC_Order) (required)
The order object for the current row.

ListTable::render_wc_actions_column() code WC 7.1.0

public function render_wc_actions_column( WC_Order $order ): void {
	echo '<p>';

	/**
	 * Fires before the order action buttons (within the actions column for the order list table)
	 * are registered.
	 *
	 * @param WC_Order $order Current order object.
	 * @since 6.7.0
	 */
	do_action( 'woocommerce_admin_order_actions_start', $order );

	$actions = array();

	if ( $order->has_status( array( 'pending', 'on-hold' ) ) ) {
		$actions['processing'] = array(
			'url'    => wp_nonce_url( admin_url( 'admin-ajax.php?action=woocommerce_mark_order_status&status=processing&order_id=' . $order->get_id() ), 'woocommerce-mark-order-status' ),
			'name'   => __( 'Processing', 'woocommerce' ),
			'action' => 'processing',
		);
	}

	if ( $order->has_status( array( 'pending', 'on-hold', 'processing' ) ) ) {
		$actions['complete'] = array(
			'url'    => wp_nonce_url( admin_url( 'admin-ajax.php?action=woocommerce_mark_order_status&status=completed&order_id=' . $order->get_id() ), 'woocommerce-mark-order-status' ),
			'name'   => __( 'Complete', 'woocommerce' ),
			'action' => 'complete',
		);
	}

	/**
	 * Provides an opportunity to modify the action buttons within the order list table.
	 *
	 * @param array    $action Order actions.
	 * @param WC_Order $order  Current order object.
	 * @since 6.7.0
	 */
	$actions = apply_filters( 'woocommerce_admin_order_actions', $actions, $order );

	// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
	echo wc_render_action_buttons( $actions );

	/**
	 * Fires after the order action buttons (within the actions column for the order list table)
	 * are rendered.
	 *
	 * @param WC_Order $order Current order object.
	 * @since 6.7.0
	 */
	do_action( 'woocommerce_admin_order_actions_end', $order );

	echo '</p>';
}