WC_Admin_List_Table_Orders::get_order_preview_actions_html()public staticWC 1.0

Get actions to display in the preview as HTML.

Метод класса: WC_Admin_List_Table_Orders{}

Хуки из метода

Возвращает

Строку.

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

$result = WC_Admin_List_Table_Orders::get_order_preview_actions_html( $order );
$order(WC_Order) (обязательный)
Order object.

Код WC_Admin_List_Table_Orders::get_order_preview_actions_html() WC 9.3.3

public static function get_order_preview_actions_html( $order ) {
	$actions        = array();
	$status_actions = array();

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

	if ( $order->has_status( array( 'pending', 'on-hold' ) ) ) {
		$status_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' ),
			'title'  => __( 'Change order status to processing', 'woocommerce' ),
			'action' => 'processing',
		);
	}

	if ( $order->has_status( array( 'pending', 'on-hold', 'processing' ) ) ) {
		$status_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'   => __( 'Completed', 'woocommerce' ),
			'title'  => __( 'Change order status to completed', 'woocommerce' ),
			'action' => 'complete',
		);
	}

	if ( $status_actions ) {
		$actions['status'] = array(
			'group'   => __( 'Change status: ', 'woocommerce' ),
			'actions' => $status_actions,
		);
	}

	return wc_render_action_buttons( apply_filters( 'woocommerce_admin_order_preview_actions', $actions, $order ) );
}