Automattic\WooCommerce\Internal\RestApi\Routes\V4\Fulfillments
Controller::get_fulfillments
Get a list of fulfillments for a specific order.
Метод класса: Controller{}
Хуков нет.
Возвращает
WP_REST_Response.
Использование
$Controller = new Controller(); $Controller->get_fulfillments( $request ): WP_REST_Response;
- $request(WP_REST_Request) (обязательный)
- Full details about the request.
Код Controller::get_fulfillments() Controller::get fulfillments WC 11.2.2
public function get_fulfillments( WP_REST_Request $request ): WP_REST_Response {
$order_id = (int) $request->get_param( 'order_id' );
// Validate the order ID.
if ( ! $order_id ) {
return $this->prepare_error_response(
'woocommerce_rest_order_id_required',
__( 'The order ID is required.', 'woocommerce' ),
array( 'status' => esc_attr( WP_Http::BAD_REQUEST ) )
);
}
$order = wc_get_order( $order_id );
if ( ! $order ) {
return $this->prepare_error_response(
'woocommerce_rest_order_invalid_id',
__( 'Invalid order ID.', 'woocommerce' ),
array( 'status' => esc_attr( WP_Http::NOT_FOUND ) )
);
}
$request->set_param( 'order_id', $order_id );
return $this->order_fulfillments_controller->get_fulfillments( $request );
}