WordPress at Your Fingertips
function is not described

WC_REST_Orders_V2_Controller::get_object() protected WC 3.0.0

Get object. Return false if object is not of required type.

{} It's a method of the class: WC_REST_Orders_V2_Controller{}

No Hooks.




// protected - for code of main (parent) or child class
$result = $this->get_object( $id );
$id(int) (required)
Object ID.


Since 3.0.0 Introduced.

Code of WC_REST_Orders_V2_Controller::get_object() WC 6.1.1

protected function get_object( $id ) {
	$order = wc_get_order( $id );
	// In case id is a refund's id (or it's not an order at all), don't expose it via /orders/ path.
	if ( ! $order || 'shop_order_refund' === $order->get_type() ) {
		return false;

	return $order;