WC_REST_Orders_V2_Controller::item_is_null()protectedWC 1.0

Helper method to check if the resource ID associated with the provided item is null. Items can be deleted by setting the resource ID to null.

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

Хуков нет.

Возвращает

true|false. True if the item resource ID is null, false otherwise.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->item_is_null( $item );
$item(массив) (обязательный)
Item provided in the request body.

Код WC_REST_Orders_V2_Controller::item_is_null() WC 8.7.0

protected function item_is_null( $item ) {
	$keys = array( 'product_id', 'method_id', 'method_title', 'name', 'code' );

	foreach ( $keys as $key ) {
		if ( array_key_exists( $key, $item ) && is_null( $item[ $key ] ) ) {
			return true;
		}
	}

	return false;
}