Automattic\WooCommerce\Internal\CLI\Migrator\Platforms\Shopify
ShopifyClient::graphql_request
Makes a request to the Shopify GraphQL API.
Method of the class: ShopifyClient{}
No Hooks.
Returns
Object|\WP_Error. Decoded JSON response data or WP_Error on failure.
Usage
$ShopifyClient = new ShopifyClient(); $ShopifyClient->graphql_request( $query, $variables );
- $query(string) (required)
- The GraphQL query string.
- $variables(array)
- The variables for the query.
Default:array()
ShopifyClient::graphql_request() ShopifyClient::graphql request code WC 10.7.0
public function graphql_request( string $query, array $variables = array() ) {
$credentials = $this->get_credentials();
if ( is_wp_error( $credentials ) ) {
return $credentials;
}
$graphql_endpoint = $this->build_graphql_url( $credentials['domain'] );
$request_args = $this->build_graphql_request_args( $credentials['access_token'], $query, $variables );
$response = wp_remote_request( $graphql_endpoint, $request_args );
return $this->process_graphql_response( $response );
}