Automattic\WooCommerce\Internal\Admin\Orders\MetaBoxes

CustomMetaBox::search_metakeys_ajaxpublicWC 1.0

WP Ajax handler to render the list of unique meta keys asynchronously.

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

Хуков нет.

Возвращает

null. Ничего (null).

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

$CustomMetaBox = new CustomMetaBox();
$CustomMetaBox->search_metakeys_ajax(): void;

Код CustomMetaBox::search_metakeys_ajax() WC 10.3.4

public function search_metakeys_ajax(): void {
	check_ajax_referer( 'search-order-metakeys', 'security' );

	if ( ! isset( $_GET['order_id'] ) || ! current_user_can( 'edit_shop_orders' ) ) {
		wp_die( -1 );
	}

	$order_id = intval( $_GET['order_id'] );
	$order    = wc_get_order( $order_id );
	if ( ! is_a( $order, \WC_Order::class ) ) {
		wp_die( -1 );
	}

	$found_order_meta_keys = $this->order_meta_keys_autofill( null, $order );

	wp_send_json( $found_order_meta_keys );
}