Version: 2024-10
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { collectionRulesConditions { ruleType allowedRelations defaultRelation } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n collectionRulesConditions {\n ruleType\n allowedRelations\n defaultRelation\n }\n }`,\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n query {\n collectionRulesConditions {\n ruleType\n allowedRelations\n defaultRelation\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query {\n collectionRulesConditions {\n ruleType\n allowedRelations\n defaultRelation\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n collectionRulesConditions {\n ruleType\n allowedRelations\n defaultRelation\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n collectionRulesConditions {\n ruleType\n allowedRelations\n defaultRelation\n }\n}"
input: null
response: { "data": { "collectionRulesConditions": [ { "ruleType": "TITLE", "allowedRelations": [ "EQUALS", "NOT_EQUALS", "STARTS_WITH", "ENDS_WITH", "CONTAINS", "NOT_CONTAINS" ], "defaultRelation": "CONTAINS" }, { "ruleType": "VARIANT_TITLE", "allowedRelations": [ "EQUALS", "NOT_EQUALS", "STARTS_WITH", "ENDS_WITH", "CONTAINS", "NOT_CONTAINS" ], "defaultRelation": "CONTAINS" }, { "ruleType": "TYPE", "allowedRelations": [ "EQUALS", "NOT_EQUALS", "STARTS_WITH", "ENDS_WITH", "CONTAINS", "NOT_CONTAINS" ], "defaultRelation": "EQUALS" }, { "ruleType": "PRODUCT_TAXONOMY_NODE_ID", "allowedRelations": [ "EQUALS" ], "defaultRelation": "EQUALS" }, { "ruleType": "VENDOR", "allowedRelations": [ "EQUALS", "NOT_EQUALS", "STARTS_WITH", "ENDS_WITH", "CONTAINS", "NOT_CONTAINS" ], "defaultRelation": "EQUALS" }, { "ruleType": "IS_PRICE_REDUCED", "allowedRelations": [ "IS_SET", "IS_NOT_SET" ], "defaultRelation": "IS_SET" }, { "ruleType": "VARIANT_PRICE", "allowedRelations": [ "EQUALS", "NOT_EQUALS", "GREATER_THAN", "LESS_THAN" ], "defaultRelation": "GREATER_THAN" }, { "ruleType": "VARIANT_COMPARE_AT_PRICE", "allowedRelations": [ "EQUALS", "NOT_EQUALS", "GREATER_THAN", "LESS_THAN" ], "defaultRelation": "GREATER_THAN" }, { "ruleType": "VARIANT_INVENTORY", "allowedRelations": [ "EQUALS", "GREATER_THAN", "LESS_THAN" ], "defaultRelation": "GREATER_THAN" }, { "ruleType": "VARIANT_WEIGHT", "allowedRelations": [ "EQUALS", "NOT_EQUALS", "GREATER_THAN", "LESS_THAN" ], "defaultRelation": "GREATER_THAN" }, { "ruleType": "TAG", "allowedRelations": [ "EQUALS" ], "defaultRelation": "EQUALS" }, { "ruleType": "PRODUCT_METAFIELD_DEFINITION", "allowedRelations": [ "EQUALS", "GREATER_THAN", "LESS_THAN" ], "defaultRelation": "GREATER_THAN" }, { "ruleType": "PRODUCT_METAFIELD_DEFINITION", "allowedRelations": [ "EQUALS" ], "defaultRelation": "EQUALS" }, { "ruleType": "PRODUCT_METAFIELD_DEFINITION", "allowedRelations": [ "EQUALS", "GREATER_THAN", "LESS_THAN" ], "defaultRelation": "GREATER_THAN" }, { "ruleType": "PRODUCT_METAFIELD_DEFINITION", "allowedRelations": [ "EQUALS", "GREATER_THAN", "LESS_THAN" ], "defaultRelation": "GREATER_THAN" }, { "ruleType": "PRODUCT_METAFIELD_DEFINITION", "allowedRelations": [ "EQUALS" ], "defaultRelation": "EQUALS" }, { "ruleType": "PRODUCT_METAFIELD_DEFINITION", "allowedRelations": [ "EQUALS" ], "defaultRelation": "EQUALS" }, { "ruleType": "PRODUCT_METAFIELD_DEFINITION", "allowedRelations": [ "EQUALS" ], "defaultRelation": "EQUALS" }, { "ruleType": "VARIANT_METAFIELD_DEFINITION", "allowedRelations": [ "EQUALS", "GREATER_THAN", "LESS_THAN" ], "defaultRelation": "GREATER_THAN" }, { "ruleType": "VARIANT_METAFIELD_DEFINITION", "allowedRelations": [ "EQUALS" ], "defaultRelation": "EQUALS" }, { "ruleType": "VARIANT_METAFIELD_DEFINITION", "allowedRelations": [ "EQUALS", "GREATER_THAN", "LESS_THAN" ], "defaultRelation": "GREATER_THAN" }, { "ruleType": "VARIANT_METAFIELD_DEFINITION", "allowedRelations": [ "EQUALS" ], "defaultRelation": "EQUALS" }, { "ruleType": "VARIANT_METAFIELD_DEFINITION", "allowedRelations": [ "EQUALS" ], "defaultRelation": "EQUALS" }, { "ruleType": "VARIANT_METAFIELD_DEFINITION", "allowedRelations": [ "EQUALS" ], "defaultRelation": "EQUALS" } ] } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { collectionRulesConditions { ruleType allowedRelations defaultRelation ruleObject { ... on CollectionRuleMetafieldCondition { metafieldDefinition { id name ownerType type { name } validations { value } } } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n collectionRulesConditions {\n ruleType\n allowedRelations\n defaultRelation\n ruleObject {\n ... on CollectionRuleMetafieldCondition {\n metafieldDefinition {\n id\n name\n ownerType\n type {\n name\n }\n validations {\n value\n }\n }\n }\n }\n }\n }`,\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n query {\n collectionRulesConditions {\n ruleType\n allowedRelations\n defaultRelation\n ruleObject {\n ... on CollectionRuleMetafieldCondition {\n metafieldDefinition {\n id\n name\n ownerType\n type {\n name\n }\n validations {\n value\n }\n }\n }\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query {\n collectionRulesConditions {\n ruleType\n allowedRelations\n defaultRelation\n ruleObject {\n ... on CollectionRuleMetafieldCondition {\n metafieldDefinition {\n id\n name\n ownerType\n type {\n name\n }\n validations {\n value\n }\n }\n }\n }\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n collectionRulesConditions {\n ruleType\n allowedRelations\n defaultRelation\n ruleObject {\n ... on CollectionRuleMetafieldCondition {\n metafieldDefinition {\n id\n name\n ownerType\n type {\n name\n }\n validations {\n value\n }\n }\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n collectionRulesConditions {\n ruleType\n allowedRelations\n defaultRelation\n ruleObject {\n ... on CollectionRuleMetafieldCondition {\n metafieldDefinition {\n id\n name\n ownerType\n type {\n name\n }\n validations {\n value\n }\n }\n }\n }\n }\n}"
input: null
response: { "data": { "collectionRulesConditions": [ { "ruleType": "TITLE", "allowedRelations": [ "EQUALS", "NOT_EQUALS", "STARTS_WITH", "ENDS_WITH", "CONTAINS", "NOT_CONTAINS" ], "defaultRelation": "CONTAINS", "ruleObject": null }, { "ruleType": "VARIANT_TITLE", "allowedRelations": [ "EQUALS", "NOT_EQUALS", "STARTS_WITH", "ENDS_WITH", "CONTAINS", "NOT_CONTAINS" ], "defaultRelation": "CONTAINS", "ruleObject": null }, { "ruleType": "TYPE", "allowedRelations": [ "EQUALS", "NOT_EQUALS", "STARTS_WITH", "ENDS_WITH", "CONTAINS", "NOT_CONTAINS" ], "defaultRelation": "EQUALS", "ruleObject": null }, { "ruleType": "PRODUCT_TAXONOMY_NODE_ID", "allowedRelations": [ "EQUALS" ], "defaultRelation": "EQUALS", "ruleObject": null }, { "ruleType": "VENDOR", "allowedRelations": [ "EQUALS", "NOT_EQUALS", "STARTS_WITH", "ENDS_WITH", "CONTAINS", "NOT_CONTAINS" ], "defaultRelation": "EQUALS", "ruleObject": null }, { "ruleType": "IS_PRICE_REDUCED", "allowedRelations": [ "IS_SET", "IS_NOT_SET" ], "defaultRelation": "IS_SET", "ruleObject": null }, { "ruleType": "VARIANT_PRICE", "allowedRelations": [ "EQUALS", "NOT_EQUALS", "GREATER_THAN", "LESS_THAN" ], "defaultRelation": "GREATER_THAN", "ruleObject": null }, { "ruleType": "VARIANT_COMPARE_AT_PRICE", "allowedRelations": [ "EQUALS", "NOT_EQUALS", "GREATER_THAN", "LESS_THAN" ], "defaultRelation": "GREATER_THAN", "ruleObject": null }, { "ruleType": "VARIANT_INVENTORY", "allowedRelations": [ "EQUALS", "GREATER_THAN", "LESS_THAN" ], "defaultRelation": "GREATER_THAN", "ruleObject": null }, { "ruleType": "VARIANT_WEIGHT", "allowedRelations": [ "EQUALS", "NOT_EQUALS", "GREATER_THAN", "LESS_THAN" ], "defaultRelation": "GREATER_THAN", "ruleObject": null }, { "ruleType": "TAG", "allowedRelations": [ "EQUALS" ], "defaultRelation": "EQUALS", "ruleObject": null }, { "ruleType": "PRODUCT_METAFIELD_DEFINITION", "allowedRelations": [ "EQUALS", "GREATER_THAN", "LESS_THAN" ], "defaultRelation": "GREATER_THAN", "ruleObject": { "metafieldDefinition": { "id": "gid://shopify/MetafieldDefinition/89321433", "name": "Non-standard rating", "ownerType": "PRODUCT", "type": { "name": "rating" }, "validations": [ { "value": "1.0" }, { "value": "6.0" } ] } } }, { "ruleType": "PRODUCT_METAFIELD_DEFINITION", "allowedRelations": [ "EQUALS" ], "defaultRelation": "EQUALS", "ruleObject": { "metafieldDefinition": { "id": "gid://shopify/MetafieldDefinition/371357715", "name": "model", "ownerType": "PRODUCT", "type": { "name": "single_line_text_field" }, "validations": [ { "value": "9" } ] } } }, { "ruleType": "PRODUCT_METAFIELD_DEFINITION", "allowedRelations": [ "EQUALS", "GREATER_THAN", "LESS_THAN" ], "defaultRelation": "GREATER_THAN", "ruleObject": { "metafieldDefinition": { "id": "gid://shopify/MetafieldDefinition/397285273", "name": "Competitor cost", "ownerType": "PRODUCT", "type": { "name": "number_decimal" }, "validations": [] } } }, { "ruleType": "PRODUCT_METAFIELD_DEFINITION", "allowedRelations": [ "EQUALS", "GREATER_THAN", "LESS_THAN" ], "defaultRelation": "GREATER_THAN", "ruleObject": { "metafieldDefinition": { "id": "gid://shopify/MetafieldDefinition/475536288", "name": "Year released", "ownerType": "PRODUCT", "type": { "name": "number_integer" }, "validations": [] } } }, { "ruleType": "PRODUCT_METAFIELD_DEFINITION", "allowedRelations": [ "EQUALS" ], "defaultRelation": "EQUALS", "ruleObject": { "metafieldDefinition": { "id": "gid://shopify/MetafieldDefinition/660917123", "name": "Materials", "ownerType": "PRODUCT", "type": { "name": "list.single_line_text_field" }, "validations": [] } } }, { "ruleType": "PRODUCT_METAFIELD_DEFINITION", "allowedRelations": [ "EQUALS" ], "defaultRelation": "EQUALS", "ruleObject": { "metafieldDefinition": { "id": "gid://shopify/MetafieldDefinition/804905764", "name": "Recyclable", "ownerType": "PRODUCT", "type": { "name": "boolean" }, "validations": [] } } }, { "ruleType": "PRODUCT_METAFIELD_DEFINITION", "allowedRelations": [ "EQUALS" ], "defaultRelation": "EQUALS", "ruleObject": { "metafieldDefinition": { "id": "gid://shopify/MetafieldDefinition/985769189", "name": "Exporters", "ownerType": "PRODUCT", "type": { "name": "list.single_line_text_field" }, "validations": [] } } }, { "ruleType": "VARIANT_METAFIELD_DEFINITION", "allowedRelations": [ "EQUALS", "GREATER_THAN", "LESS_THAN" ], "defaultRelation": "GREATER_THAN", "ruleObject": { "metafieldDefinition": { "id": "gid://shopify/MetafieldDefinition/180578340", "name": "competitor cost", "ownerType": "PRODUCTVARIANT", "type": { "name": "number_decimal" }, "validations": [] } } }, { "ruleType": "VARIANT_METAFIELD_DEFINITION", "allowedRelations": [ "EQUALS" ], "defaultRelation": "EQUALS", "ruleObject": { "metafieldDefinition": { "id": "gid://shopify/MetafieldDefinition/406572501", "name": "Contents", "ownerType": "PRODUCTVARIANT", "type": { "name": "list.single_line_text_field" }, "validations": [] } } }, { "ruleType": "VARIANT_METAFIELD_DEFINITION", "allowedRelations": [ "EQUALS", "GREATER_THAN", "LESS_THAN" ], "defaultRelation": "GREATER_THAN", "ruleObject": { "metafieldDefinition": { "id": "gid://shopify/MetafieldDefinition/685760035", "name": "size of the item", "ownerType": "PRODUCTVARIANT", "type": { "name": "number_integer" }, "validations": [] } } }, { "ruleType": "VARIANT_METAFIELD_DEFINITION", "allowedRelations": [ "EQUALS" ], "defaultRelation": "EQUALS", "ruleObject": { "metafieldDefinition": { "id": "gid://shopify/MetafieldDefinition/898504968", "name": "Recyclable", "ownerType": "PRODUCTVARIANT", "type": { "name": "boolean" }, "validations": [] } } }, { "ruleType": "VARIANT_METAFIELD_DEFINITION", "allowedRelations": [ "EQUALS" ], "defaultRelation": "EQUALS", "ruleObject": { "metafieldDefinition": { "id": "gid://shopify/MetafieldDefinition/1043030858", "name": "available", "ownerType": "PRODUCTVARIANT", "type": { "name": "single_line_text_field" }, "validations": [] } } }, { "ruleType": "VARIANT_METAFIELD_DEFINITION", "allowedRelations": [ "EQUALS" ], "defaultRelation": "EQUALS", "ruleObject": { "metafieldDefinition": { "id": "gid://shopify/MetafieldDefinition/1067782171", "name": "Exporters", "ownerType": "PRODUCTVARIANT", "type": { "name": "list.single_line_text_field" }, "validations": [] } } } ] } }