Automattic\WooCommerce\Internal\CLI\Migrator\Platforms\Shopify

ShopifyClient::build_graphql_urlprivateWC 1.0

Build the GraphQL API URL.

Method of the class: ShopifyClient{}

No Hooks.

Returns

String. The complete GraphQL API URL.

Usage

// private - for code of main (parent) class only
$result = $this->build_graphql_url( $domain ): string;
$domain(string) (required)
The Shopify domain.

ShopifyClient::build_graphql_url() code WC 10.7.0

private function build_graphql_url( string $domain ): string {
	// Ensure the domain has the protocol.
	if ( ! preg_match( '~^https?://~i', $domain ) ) {
		$domain = 'https://' . $domain;
	}

	$shop_url = untrailingslashit( $domain );
	// Use the same API version as REST.
	$api_version = '2025-04';
	return "{$shop_url}/admin/api/{$api_version}/graphql.json";
}