Automattic\WooCommerce\Internal\RestApi\Routes\V4\Orders

Controller::is_valid_order_for_requestprotectedWC 1.0

Check if an order is valid.

Method of the class: Controller{}

No Hooks.

Returns

true|false. True if the order is valid, false otherwise.

Usage

// protected - for code of main (parent) or child class
$result = $this->is_valid_order_for_request( $order ): bool;
$order(WC_Order) (required)
The order object.

Controller::is_valid_order_for_request() code WC 10.4.3

protected function is_valid_order_for_request( $order ): bool {
	return $order instanceof WC_Order && $order->get_id() !== 0 && 'shop_order_refund' !== $order->get_type();
}