Automattic\WooCommerce\Internal\CLI\Migrator\Platforms\Shopify
ShopifyFetcher::build_graphql_variables
Build GraphQL variables from fetch arguments.
Method of the class: ShopifyFetcher{}
No Hooks.
Returns
Array. The GraphQL variables.
Usage
// private - for code of main (parent) class only $result = $this->build_graphql_variables( $args ): array;
- $args(array) (required)
- The fetch arguments.
ShopifyFetcher::build_graphql_variables() ShopifyFetcher::build graphql variables code WC 10.8.1
private function build_graphql_variables( array $args ): array {
$variables = array(
'first' => $args['limit'] ?? 50,
'after' => $args['after_cursor'] ?? null,
'query' => $this->build_graphql_query_string( $args ),
'variantsFirst' => $args['variants_per_product'] ?? 100,
);
// Remove null values to avoid GraphQL issues.
return array_filter(
$variables,
function ( $value ) {
return null !== $value && '' !== $value;
}
);
}