Automattic\WooCommerce\Admin\Features\Fulfillments

OrderFulfillmentsRestController::resolve_route_id │ private │ WC 1.0

Resolve a route identifier (order or fulfillment id) from the matched URL.

The native v3 routes carry both ids as URL path segments; the v4 facade injects them via set_param() after deriving them from the fulfillment. Reading the URL-captured value first keeps the handler bound to the route it matched, and falls back to the injected param for the v4 path.

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

Хуков нет.

Возвращает

int. The resolved identifier, or 0 when absent.

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

// private - только в коде основоного (родительского) класса
$result = $this->resolve_route_id( $request, $key ): int;
$request(WP_REST_Request) (обязательный)
The request object.
$key(строка) (обязательный)
Either 'order_id' or 'fulfillment_id'.

Код OrderFulfillmentsRestController::resolve_route_id() WC 11.3.0

private function resolve_route_id( WP_REST_Request $request, string $key ): int {
	$url_params = $request->get_url_params();

	return (int) ( $url_params[ $key ] ?? $request->get_param( $key ) );
}