collection Createmutation
mutation
2024-10latest
Requires write
access scope. Also: The app must have access to the input fields used to create the collection. Further, the store must not be on the Starter or Retail plans and user must have a permission to create collection.
Creates a collection.
Arguments
The properties to use when creating the collection.
Was this section helpful?
CollectionCreatePayload returns
The collection that has been created.
The list of errors that occurred from executing the mutation.
Was this section helpful?
Code examples for MUTATION: collectionCreate
Query Reference for MUTATION: collectionCreate
"mutation collectionCreate($input: CollectionInput!) {\n collectionCreate(input: $input) {\n collection {\n # Collection fields\n }\n userErrors {\n field\n message\n }\n }\n}"
Input Reference for MUTATION: collectionCreate
"{\n \"input\": {\n \"descriptionHtml\": \"<your-descriptionHtml>\",\n \"handle\": \"<your-handle>\",\n \"id\": \"gid://shopify/<objectName>/10079785100\",\n \"image\": {\n \"altText\": \"<your-altText>\",\n \"id\": \"gid://shopify/<objectName>/10079785100\",\n \"src\": \"<your-src>\"\n },\n \"metafields\": [\n {\n \"description\": \"<your-description>\",\n \"id\": \"gid://shopify/<objectName>/10079785100\",\n \"key\": \"<your-key>\",\n \"namespace\": \"<your-namespace>\",\n \"type\": \"<your-type>\",\n \"value\": \"<your-value>\"\n }\n ],\n \"products\": [\n \"gid://shopify/<objectName>/10079785100\"\n ],\n \"redirectNewHandle\": true,\n \"ruleSet\": {\n \"appliedDisjunctively\": true,\n \"rules\": [\n {\n \"column\": \"IS_PRICE_REDUCED\",\n \"condition\": \"<your-condition>\",\n \"conditionObjectId\": \"gid://shopify/<objectName>/10079785100\",\n \"relation\": \"CONTAINS\"\n }\n ]\n },\n \"seo\": {\n \"description\": \"<your-description>\",\n \"title\": \"<your-title>\"\n },\n \"sortOrder\": \"ALPHA_ASC\",\n \"templateSuffix\": \"<your-templateSuffix>\",\n \"title\": \"<your-title>\"\n }\n}"
Schema Reference for MUTATION: collectionCreate
"input CollectionInput {\n descriptionHtml: String\n handle: String\n id: ID\n image: ImageInput\n metafields: [MetafieldInput!]\n privateMetafields: [PrivateMetafieldInput!]\n products: [ID!]\n publications: [CollectionPublicationInput!]\n redirectNewHandle: Boolean\n ruleSet: CollectionRuleSetInput\n seo: SEOInput\n sortOrder: CollectionSortOrder\n templateSuffix: String\n title: String\n}\n\ninput ImageInput {\n altText: String\n id: ID\n src: String\n}\n\ninput MetafieldInput {\n description: String\n id: ID\n key: String\n namespace: String\n type: String\n value: String\n}\n\ninput PrivateMetafieldInput {\n key: String!\n namespace: String!\n owner: ID\n valueInput: PrivateMetafieldValueInput!\n}\n\ninput CollectionPublicationInput {\n channelHandle: String\n channelId: ID\n publicationId: ID\n}\n\ninput CollectionRuleSetInput {\n appliedDisjunctively: Boolean!\n rules: [CollectionRuleInput!]\n}\n\ninput SEOInput {\n description: String\n title: String\n}\n"
Display Examples for MUTATION: collectionCreate
[ { "example": { "type_name": "collectioncreate", "title": "Create a new metafield on a new collection", "description": "Create a new metafield `my_field.subtitle` on a new\ncollection.\n\n\nAlternatively, refer to the\n[metafieldsSet](https://shopify.dev/api/admin-graphql/latest/mutations/metafieldsset) mutation\nto create and/or update metafields on collection resources.\n", "query_string": "mutation createCollectionMetafields($input: CollectionInput!) {\n collectionCreate(input: $input) {\n collection {\n id\n metafields(first: 3) {\n edges {\n node {\n id\n namespace\n key\n value\n }\n }\n }\n }\n userErrors {\n message\n field\n }\n }\n}", "variables": { "input": { "metafields": [ { "namespace": "my_field", "key": "subtitle", "type": "single_line_text_field", "value": "Bold Colors" } ], "title": "Spring Styles" } }, "response": { "data": { "collectionCreate": { "collection": { "id": "gid://shopify/Collection/1063001313", "metafields": { "edges": [ { "node": { "id": "gid://shopify/Metafield/1069229064", "namespace": "my_field", "key": "subtitle", "value": "Bold Colors" } } ] } }, "userErrors": [] } } }, "api_name": "admin", "location": "/components/merchandising/test/unit/graph_api/admin/mutations/collection_create_test.rb", "minimum_api_version": null, "maximum_api_version": null, "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\": \"mutation createCollectionMetafields($input: CollectionInput!) { collectionCreate(input: $input) { collection { id metafields(first: 3) { edges { node { id namespace key value } } } } userErrors { message field } } }\",\n \"variables\": {\n \"input\": {\n \"metafields\": [\n {\n \"namespace\": \"my_field\",\n \"key\": \"subtitle\",\n \"type\": \"single_line_text_field\",\n \"value\": \"Bold Colors\"\n }\n ],\n \"title\": \"Spring Styles\"\n }\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation createCollectionMetafields($input: CollectionInput!) {\n collectionCreate(input: $input) {\n collection {\n id\n metafields(first: 3) {\n edges {\n node {\n id\n namespace\n key\n value\n }\n }\n }\n }\n userErrors {\n message\n field\n }\n }\n }`,\n {\n variables: {\n \"input\": {\n \"metafields\": [\n {\n \"namespace\": \"my_field\",\n \"key\": \"subtitle\",\n \"type\": \"single_line_text_field\",\n \"value\": \"Bold Colors\"\n }\n ],\n \"title\": \"Spring Styles\"\n }\n },\n },\n);\n\nconst data = await response.json();\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 mutation createCollectionMetafields($input: CollectionInput!) {\n collectionCreate(input: $input) {\n collection {\n id\n metafields(first: 3) {\n edges {\n node {\n id\n namespace\n key\n value\n }\n }\n }\n }\n userErrors {\n message\n field\n }\n }\n }\nQUERY\n\nvariables = {\n \"input\": {\n \"metafields\": [{\"namespace\"=>\"my_field\", \"key\"=>\"subtitle\", \"type\"=>\"single_line_text_field\", \"value\"=>\"Bold Colors\"}],\n \"title\": \"Spring Styles\"\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation createCollectionMetafields($input: CollectionInput!) {\n collectionCreate(input: $input) {\n collection {\n id\n metafields(first: 3) {\n edges {\n node {\n id\n namespace\n key\n value\n }\n }\n }\n }\n userErrors {\n message\n field\n }\n }\n }`,\n \"variables\": {\n \"input\": {\n \"metafields\": [\n {\n \"namespace\": \"my_field\",\n \"key\": \"subtitle\",\n \"type\": \"single_line_text_field\",\n \"value\": \"Bold Colors\"\n }\n ],\n \"title\": \"Spring Styles\"\n }\n },\n },\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation createCollectionMetafields($input: CollectionInput!) {\n collectionCreate(input: $input) {\n collection {\n id\n metafields(first: 3) {\n edges {\n node {\n id\n namespace\n key\n value\n }\n }\n }\n }\n userErrors {\n message\n field\n }\n }\n }\nQUERY;\n\n$variables = [\n \"input\" => [\n \"metafields\" => [{\"namespace\"=>\"my_field\", \"key\"=>\"subtitle\", \"type\"=>\"single_line_text_field\", \"value\"=>\"Bold Colors\"}],\n \"title\" => \"Spring Styles\",\n ],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [ { "arg": { "name": "input", "description": "The properties to use when creating the collection.", "type": { "kind": "INPUT_OBJECT", "name": "CollectionInput", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "CollectionInput!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "input", "argValue": " {\"metafields\":[{\"namespace\":\"my_field\",\"key\":\"subtitle\",\"type\":\"single_line_text_field\",\"value\":\"Bold Colors\"}],\"title\":\"Spring Styles\"}", "typeKind": "MUTATION" } ] }, { "example": { "type_name": "collectioncreate", "title": "Create a smart collection", "description": "Create a collection that contains all the products with a specified word in their title.", "query_string": "mutation CollectionCreate($input: CollectionInput!) {\n collectionCreate(input: $input) {\n userErrors {\n field\n message\n }\n collection {\n id\n title\n descriptionHtml\n handle\n sortOrder\n ruleSet {\n appliedDisjunctively\n rules {\n column\n relation\n condition\n }\n }\n }\n }\n}", "variables": { "input": { "title": "Our entire shoe collection", "descriptionHtml": "View <b>every</b> shoe available in our store.", "ruleSet": { "appliedDisjunctively": false, "rules": { "column": "TITLE", "relation": "CONTAINS", "condition": "shoe" } } } }, "response": { "data": { "collectionCreate": { "userErrors": [], "collection": { "id": "gid://shopify/Collection/1063001311", "title": "Our entire shoe collection", "descriptionHtml": "View <b>every</b> shoe available in our store.", "handle": "our-entire-shoe-collection", "sortOrder": "BEST_SELLING", "ruleSet": { "appliedDisjunctively": false, "rules": [ { "column": "TITLE", "relation": "CONTAINS", "condition": "shoe" } ] } } } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/merchandising/test/unit/graph_api/admin/mutations/collection_create_test.rb", "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\": \"mutation CollectionCreate($input: CollectionInput!) { collectionCreate(input: $input) { userErrors { field message } collection { id title descriptionHtml handle sortOrder ruleSet { appliedDisjunctively rules { column relation condition } } } } }\",\n \"variables\": {\n \"input\": {\n \"title\": \"Our entire shoe collection\",\n \"descriptionHtml\": \"View <b>every</b> shoe available in our store.\",\n \"ruleSet\": {\n \"appliedDisjunctively\": false,\n \"rules\": {\n \"column\": \"TITLE\",\n \"relation\": \"CONTAINS\",\n \"condition\": \"shoe\"\n }\n }\n }\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation CollectionCreate($input: CollectionInput!) {\n collectionCreate(input: $input) {\n userErrors {\n field\n message\n }\n collection {\n id\n title\n descriptionHtml\n handle\n sortOrder\n ruleSet {\n appliedDisjunctively\n rules {\n column\n relation\n condition\n }\n }\n }\n }\n }`,\n {\n variables: {\n \"input\": {\n \"title\": \"Our entire shoe collection\",\n \"descriptionHtml\": \"View <b>every</b> shoe available in our store.\",\n \"ruleSet\": {\n \"appliedDisjunctively\": false,\n \"rules\": {\n \"column\": \"TITLE\",\n \"relation\": \"CONTAINS\",\n \"condition\": \"shoe\"\n }\n }\n }\n },\n },\n);\n\nconst data = await response.json();\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 mutation CollectionCreate($input: CollectionInput!) {\n collectionCreate(input: $input) {\n userErrors {\n field\n message\n }\n collection {\n id\n title\n descriptionHtml\n handle\n sortOrder\n ruleSet {\n appliedDisjunctively\n rules {\n column\n relation\n condition\n }\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"input\": {\n \"title\": \"Our entire shoe collection\",\n \"descriptionHtml\": \"View <b>every</b> shoe available in our store.\",\n \"ruleSet\": {\n \"appliedDisjunctively\": false,\n \"rules\": {\n \"column\": \"TITLE\",\n \"relation\": \"CONTAINS\",\n \"condition\": \"shoe\"\n }\n }\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation CollectionCreate($input: CollectionInput!) {\n collectionCreate(input: $input) {\n userErrors {\n field\n message\n }\n collection {\n id\n title\n descriptionHtml\n handle\n sortOrder\n ruleSet {\n appliedDisjunctively\n rules {\n column\n relation\n condition\n }\n }\n }\n }\n }`,\n \"variables\": {\n \"input\": {\n \"title\": \"Our entire shoe collection\",\n \"descriptionHtml\": \"View <b>every</b> shoe available in our store.\",\n \"ruleSet\": {\n \"appliedDisjunctively\": false,\n \"rules\": {\n \"column\": \"TITLE\",\n \"relation\": \"CONTAINS\",\n \"condition\": \"shoe\"\n }\n }\n }\n },\n },\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation CollectionCreate($input: CollectionInput!) {\n collectionCreate(input: $input) {\n userErrors {\n field\n message\n }\n collection {\n id\n title\n descriptionHtml\n handle\n sortOrder\n ruleSet {\n appliedDisjunctively\n rules {\n column\n relation\n condition\n }\n }\n }\n }\n }\nQUERY;\n\n$variables = [\n \"input\" => [\n \"title\" => \"Our entire shoe collection\",\n \"descriptionHtml\" => \"View <b>every</b> shoe available in our store.\",\n \"ruleSet\" => [\n \"appliedDisjunctively\" => false,\n \"rules\" => [\n \"column\" => \"TITLE\",\n \"relation\" => \"CONTAINS\",\n \"condition\" => \"shoe\",\n ],\n ],\n ],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [ { "arg": { "name": "input", "description": "The properties to use when creating the collection.", "type": { "kind": "INPUT_OBJECT", "name": "CollectionInput", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "CollectionInput!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "input", "argValue": " {\"title\":\"Our entire shoe collection\",\"descriptionHtml\":\"View <b>every</b> shoe available in our store.\",\"ruleSet\":{\"appliedDisjunctively\":false,\"rules\":{\"column\":\"TITLE\",\"relation\":\"CONTAINS\",\"condition\":\"shoe\"}}}", "typeKind": "MUTATION" } ] }, { "example": { "type_name": "collectioncreate", "title": "Create a smart collection with metafield definition conditions", "description": "Create a smart collection that contains all products with the specific product and variant metafield definition conditions.\nThis will match all products that have the product metafield value \"leather\" and the variant metafield value \"true\".\n", "query_string": "mutation CollectionCreate($input: CollectionInput!) {\n collectionCreate(input: $input) {\n userErrors {\n field\n message\n }\n collection {\n id\n title\n descriptionHtml\n handle\n sortOrder\n ruleSet {\n appliedDisjunctively\n rules {\n column\n relation\n condition\n conditionObject {\n ... on CollectionRuleMetafieldCondition {\n metafieldDefinition {\n id\n name\n type {\n name\n }\n ownerType\n }\n }\n }\n }\n }\n }\n }\n}", "variables": { "input": { "title": "Our entire leather collection", "descriptionHtml": "Check out our leather products.", "ruleSet": { "appliedDisjunctively": false, "rules": [ { "column": "PRODUCT_METAFIELD_DEFINITION", "relation": "EQUALS", "condition": "leather", "conditionObjectId": "gid://shopify/MetafieldDefinition/1071456152" }, { "column": "VARIANT_METAFIELD_DEFINITION", "relation": "EQUALS", "condition": "true", "conditionObjectId": "gid://shopify/MetafieldDefinition/1071456153" } ] } } }, "response": { "data": { "collectionCreate": { "userErrors": [], "collection": { "id": "gid://shopify/Collection/1063001312", "title": "Our entire leather collection", "descriptionHtml": "Check out our leather products.", "handle": "our-entire-leather-collection", "sortOrder": "BEST_SELLING", "ruleSet": { "appliedDisjunctively": false, "rules": [ { "column": "PRODUCT_METAFIELD_DEFINITION", "relation": "EQUALS", "condition": "leather", "conditionObject": { "metafieldDefinition": { "id": "gid://shopify/MetafieldDefinition/1071456152", "name": "Material", "type": { "name": "single_line_text_field" }, "ownerType": "PRODUCT" } } }, { "column": "VARIANT_METAFIELD_DEFINITION", "relation": "EQUALS", "condition": "true", "conditionObject": { "metafieldDefinition": { "id": "gid://shopify/MetafieldDefinition/1071456153", "name": "Imported", "type": { "name": "boolean" }, "ownerType": "PRODUCTVARIANT" } } } ] } } } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/merchandising/test/unit/graph_api/admin/mutations/collection_create_test.rb", "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\": \"mutation CollectionCreate($input: CollectionInput!) { collectionCreate(input: $input) { userErrors { field message } collection { id title descriptionHtml handle sortOrder ruleSet { appliedDisjunctively rules { column relation condition conditionObject { ... on CollectionRuleMetafieldCondition { metafieldDefinition { id name type { name } ownerType } } } } } } } }\",\n \"variables\": {\n \"input\": {\n \"title\": \"Our entire leather collection\",\n \"descriptionHtml\": \"Check out our leather products.\",\n \"ruleSet\": {\n \"appliedDisjunctively\": false,\n \"rules\": [\n {\n \"column\": \"PRODUCT_METAFIELD_DEFINITION\",\n \"relation\": \"EQUALS\",\n \"condition\": \"leather\",\n \"conditionObjectId\": \"gid://shopify/MetafieldDefinition/1071456152\"\n },\n {\n \"column\": \"VARIANT_METAFIELD_DEFINITION\",\n \"relation\": \"EQUALS\",\n \"condition\": \"true\",\n \"conditionObjectId\": \"gid://shopify/MetafieldDefinition/1071456153\"\n }\n ]\n }\n }\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation CollectionCreate($input: CollectionInput!) {\n collectionCreate(input: $input) {\n userErrors {\n field\n message\n }\n collection {\n id\n title\n descriptionHtml\n handle\n sortOrder\n ruleSet {\n appliedDisjunctively\n rules {\n column\n relation\n condition\n conditionObject {\n ... on CollectionRuleMetafieldCondition {\n metafieldDefinition {\n id\n name\n type {\n name\n }\n ownerType\n }\n }\n }\n }\n }\n }\n }\n }`,\n {\n variables: {\n \"input\": {\n \"title\": \"Our entire leather collection\",\n \"descriptionHtml\": \"Check out our leather products.\",\n \"ruleSet\": {\n \"appliedDisjunctively\": false,\n \"rules\": [\n {\n \"column\": \"PRODUCT_METAFIELD_DEFINITION\",\n \"relation\": \"EQUALS\",\n \"condition\": \"leather\",\n \"conditionObjectId\": \"gid://shopify/MetafieldDefinition/1071456152\"\n },\n {\n \"column\": \"VARIANT_METAFIELD_DEFINITION\",\n \"relation\": \"EQUALS\",\n \"condition\": \"true\",\n \"conditionObjectId\": \"gid://shopify/MetafieldDefinition/1071456153\"\n }\n ]\n }\n }\n },\n },\n);\n\nconst data = await response.json();\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 mutation CollectionCreate($input: CollectionInput!) {\n collectionCreate(input: $input) {\n userErrors {\n field\n message\n }\n collection {\n id\n title\n descriptionHtml\n handle\n sortOrder\n ruleSet {\n appliedDisjunctively\n rules {\n column\n relation\n condition\n conditionObject {\n ... on CollectionRuleMetafieldCondition {\n metafieldDefinition {\n id\n name\n type {\n name\n }\n ownerType\n }\n }\n }\n }\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"input\": {\n \"title\": \"Our entire leather collection\",\n \"descriptionHtml\": \"Check out our leather products.\",\n \"ruleSet\": {\n \"appliedDisjunctively\": false,\n \"rules\": [{\"column\"=>\"PRODUCT_METAFIELD_DEFINITION\", \"relation\"=>\"EQUALS\", \"condition\"=>\"leather\", \"conditionObjectId\"=>\"gid://shopify/MetafieldDefinition/1071456152\"}, {\"column\"=>\"VARIANT_METAFIELD_DEFINITION\", \"relation\"=>\"EQUALS\", \"condition\"=>\"true\", \"conditionObjectId\"=>\"gid://shopify/MetafieldDefinition/1071456153\"}]\n }\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation CollectionCreate($input: CollectionInput!) {\n collectionCreate(input: $input) {\n userErrors {\n field\n message\n }\n collection {\n id\n title\n descriptionHtml\n handle\n sortOrder\n ruleSet {\n appliedDisjunctively\n rules {\n column\n relation\n condition\n conditionObject {\n ... on CollectionRuleMetafieldCondition {\n metafieldDefinition {\n id\n name\n type {\n name\n }\n ownerType\n }\n }\n }\n }\n }\n }\n }\n }`,\n \"variables\": {\n \"input\": {\n \"title\": \"Our entire leather collection\",\n \"descriptionHtml\": \"Check out our leather products.\",\n \"ruleSet\": {\n \"appliedDisjunctively\": false,\n \"rules\": [\n {\n \"column\": \"PRODUCT_METAFIELD_DEFINITION\",\n \"relation\": \"EQUALS\",\n \"condition\": \"leather\",\n \"conditionObjectId\": \"gid://shopify/MetafieldDefinition/1071456152\"\n },\n {\n \"column\": \"VARIANT_METAFIELD_DEFINITION\",\n \"relation\": \"EQUALS\",\n \"condition\": \"true\",\n \"conditionObjectId\": \"gid://shopify/MetafieldDefinition/1071456153\"\n }\n ]\n }\n }\n },\n },\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation CollectionCreate($input: CollectionInput!) {\n collectionCreate(input: $input) {\n userErrors {\n field\n message\n }\n collection {\n id\n title\n descriptionHtml\n handle\n sortOrder\n ruleSet {\n appliedDisjunctively\n rules {\n column\n relation\n condition\n conditionObject {\n ... on CollectionRuleMetafieldCondition {\n metafieldDefinition {\n id\n name\n type {\n name\n }\n ownerType\n }\n }\n }\n }\n }\n }\n }\n }\nQUERY;\n\n$variables = [\n \"input\" => [\n \"title\" => \"Our entire leather collection\",\n \"descriptionHtml\" => \"Check out our leather products.\",\n \"ruleSet\" => [\n \"appliedDisjunctively\" => false,\n \"rules\" => [{\"column\"=>\"PRODUCT_METAFIELD_DEFINITION\", \"relation\"=>\"EQUALS\", \"condition\"=>\"leather\", \"conditionObjectId\"=>\"gid://shopify/MetafieldDefinition/1071456152\"}, {\"column\"=>\"VARIANT_METAFIELD_DEFINITION\", \"relation\"=>\"EQUALS\", \"condition\"=>\"true\", \"conditionObjectId\"=>\"gid://shopify/MetafieldDefinition/1071456153\"}],\n ],\n ],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [ { "arg": { "name": "input", "description": "The properties to use when creating the collection.", "type": { "kind": "INPUT_OBJECT", "name": "CollectionInput", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "CollectionInput!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "input", "argValue": " {\"title\":\"Our entire leather collection\",\"descriptionHtml\":\"Check out our leather products.\",\"ruleSet\":{\"appliedDisjunctively\":false,\"rules\":[{\"column\":\"PRODUCT_METAFIELD_DEFINITION\",\"relation\":\"EQUALS\",\"condition\":\"leather\",\"conditionObjectId\":\"gid://shopify/MetafieldDefinition/1071456152\"},{\"column\":\"VARIANT_METAFIELD_DEFINITION\",\"relation\":\"EQUALS\",\"condition\":\"true\",\"conditionObjectId\":\"gid://shopify/MetafieldDefinition/1071456153\"}]}}", "typeKind": "MUTATION" } ] } ]