WC_Helper_API::url()public staticWC 1.0

Using the API base, form a request URL from a given endpoint.

Method of the class: WC_Helper_API{}

No Hooks.

Return

String. The absolute endpoint URL.

Usage

$result = WC_Helper_API::url( $endpoint, $query_string );
$endpoint(string) (required)
The endpoint to request.
$query_string(string)
Optional query string to append to the URL.
Default: ''

WC_Helper_API::url() code WC 8.9.0

public static function url( $endpoint, $query_string = '' ) {
	$endpoint = ltrim( $endpoint, '/' );
	$endpoint = sprintf( '%s/%s/%s', self::$api_base, $endpoint, $query_string );
	$endpoint = esc_url_raw( $endpoint );
	$endpoint = rtrim( $endpoint, '/' );
	return $endpoint;
}