# marketUpdate - admin - MUTATION Version: unstable ## Description Updates the properties of a market. ### Access Scopes `read_markets` for queries and both `read_markets` as well as `write_markets` for mutations. ## Arguments * [id](/docs/api/admin/unstable/scalars/ID): ID! - The ID of the market to update. * [input](/docs/api/admin/unstable/input-objects/MarketUpdateInput): MarketUpdateInput! - The properties to update. ## Returns * [market](/docs/api/admin/unstable/objects/Market): Market The market object. * [userErrors](/docs/api/admin/unstable/objects/MarketUserError): MarketUserError! The list of errors that occurred from executing the mutation. ## Examples ### Update a market status to make it draft Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation marketUpdate($input: MarketUpdateInput!) { marketUpdate(id: \\\"gid://shopify/Market/73827535\\\", input: $input) { market { id handle status conditions { regionsCondition { regions(first: 10) { edges { node { id name } } } } } currencySettings { baseCurrency { currencyCode } localCurrencies } } userErrors { field message code } } }\",\n \"variables\": {\n \"input\": {\n \"status\": \"DRAFT\"\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation marketUpdate($input: MarketUpdateInput!) {\n marketUpdate(id: \"gid://shopify/Market/73827535\", input: $input) {\n market {\n id\n handle\n status\n conditions {\n regionsCondition {\n regions(first: 10) {\n edges {\n node {\n id\n name\n }\n }\n }\n }\n }\n currencySettings {\n baseCurrency {\n currencyCode\n }\n localCurrencies\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n }`,\n \"variables\": {\n \"input\": {\n \"status\": \"DRAFT\"\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 mutation marketUpdate($input: MarketUpdateInput!) {\n marketUpdate(id: \"gid://shopify/Market/73827535\", input: $input) {\n market {\n id\n handle\n status\n conditions {\n regionsCondition {\n regions(first: 10) {\n edges {\n node {\n id\n name\n }\n }\n }\n }\n }\n currencySettings {\n baseCurrency {\n currencyCode\n }\n localCurrencies\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n }\nQUERY\n\nvariables = {\n \"input\": {\n \"status\": \"DRAFT\"\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation marketUpdate($input: MarketUpdateInput!) {\n marketUpdate(id: \"gid://shopify/Market/73827535\", input: $input) {\n market {\n id\n handle\n status\n conditions {\n regionsCondition {\n regions(first: 10) {\n edges {\n node {\n id\n name\n }\n }\n }\n }\n }\n currencySettings {\n baseCurrency {\n currencyCode\n }\n localCurrencies\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n }`,\n {\n variables: {\n \"input\": {\n \"status\": \"DRAFT\"\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation marketUpdate($input: MarketUpdateInput!) {\n marketUpdate(id: \"gid://shopify/Market/73827535\", input: $input) {\n market {\n id\n handle\n status\n conditions {\n regionsCondition {\n regions(first: 10) {\n edges {\n node {\n id\n name\n }\n }\n }\n }\n }\n currencySettings {\n baseCurrency {\n currencyCode\n }\n localCurrencies\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n}" #### Graphql Input { "input": { "status": "DRAFT" } } #### Graphql Response { "data": { "marketUpdate": { "market": { "id": "gid://shopify/Market/73827535", "handle": "us", "status": "DRAFT", "conditions": { "regionsCondition": { "regions": { "edges": [ { "node": { "id": "gid://shopify/MarketRegionCountry/397370199", "name": "United States" } } ] } } }, "currencySettings": { "baseCurrency": { "currencyCode": "USD" }, "localCurrencies": false } }, "userErrors": [] } } } ### Update a market to add a new catalog Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation marketUpdate($input: MarketUpdateInput!) { marketUpdate(id: \\\"gid://shopify/Market/73827535\\\", input: $input) { market { id handle status conditions { regionsCondition { regions(first: 10) { edges { node { id name } } } } } catalogs(first: 10) { edges { node { id } } } } userErrors { field message code } } }\",\n \"variables\": {\n \"input\": {\n \"catalogsToAdd\": [\n \"gid://shopify/Catalog/307400570\"\n ]\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation marketUpdate($input: MarketUpdateInput!) {\n marketUpdate(id: \"gid://shopify/Market/73827535\", input: $input) {\n market {\n id\n handle\n status\n conditions {\n regionsCondition {\n regions(first: 10) {\n edges {\n node {\n id\n name\n }\n }\n }\n }\n }\n catalogs(first: 10) {\n edges {\n node {\n id\n }\n }\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n }`,\n \"variables\": {\n \"input\": {\n \"catalogsToAdd\": [\n \"gid://shopify/Catalog/307400570\"\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 mutation marketUpdate($input: MarketUpdateInput!) {\n marketUpdate(id: \"gid://shopify/Market/73827535\", input: $input) {\n market {\n id\n handle\n status\n conditions {\n regionsCondition {\n regions(first: 10) {\n edges {\n node {\n id\n name\n }\n }\n }\n }\n }\n catalogs(first: 10) {\n edges {\n node {\n id\n }\n }\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n }\nQUERY\n\nvariables = {\n \"input\": {\n \"catalogsToAdd\": [\"gid://shopify/Catalog/307400570\"]\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation marketUpdate($input: MarketUpdateInput!) {\n marketUpdate(id: \"gid://shopify/Market/73827535\", input: $input) {\n market {\n id\n handle\n status\n conditions {\n regionsCondition {\n regions(first: 10) {\n edges {\n node {\n id\n name\n }\n }\n }\n }\n }\n catalogs(first: 10) {\n edges {\n node {\n id\n }\n }\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n }`,\n {\n variables: {\n \"input\": {\n \"catalogsToAdd\": [\n \"gid://shopify/Catalog/307400570\"\n ]\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation marketUpdate($input: MarketUpdateInput!) {\n marketUpdate(id: \"gid://shopify/Market/73827535\", input: $input) {\n market {\n id\n handle\n status\n conditions {\n regionsCondition {\n regions(first: 10) {\n edges {\n node {\n id\n name\n }\n }\n }\n }\n }\n catalogs(first: 10) {\n edges {\n node {\n id\n }\n }\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n}" #### Graphql Input { "input": { "catalogsToAdd": [ "gid://shopify/Catalog/307400570" ] } } #### Graphql Response { "data": { "marketUpdate": { "market": { "id": "gid://shopify/Market/73827535", "handle": "us", "status": "ACTIVE", "conditions": { "regionsCondition": { "regions": { "edges": [ { "node": { "id": "gid://shopify/MarketRegionCountry/397370199", "name": "United States" } } ] } } }, "catalogs": { "edges": [ { "node": { "id": "gid://shopify/MarketCatalog/73827535" } }, { "node": { "id": "gid://shopify/MarketCatalog/307400570" } } ] } }, "userErrors": [] } } } ### Update a market to change its conditions Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation marketUpdate($input: MarketUpdateInput!) { marketUpdate(id: \\\"gid://shopify/Market/73827535\\\", input: $input) { market { id handle status conditions { regionsCondition { regions(first: 10) { edges { node { id name } } } } } catalogs(first: 10) { edges { node { id } } } } userErrors { field message code } } }\",\n \"variables\": {\n \"input\": {\n \"conditions\": {\n \"conditionsToAdd\": {\n \"regionsCondition\": {\n \"regions\": [\n {\n \"countryCode\": \"GB\"\n }\n ]\n }\n },\n \"conditionsToDelete\": {\n \"regionsCondition\": {\n \"regions\": [\n {\n \"countryCode\": \"US\"\n }\n ]\n }\n }\n }\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation marketUpdate($input: MarketUpdateInput!) {\n marketUpdate(id: \"gid://shopify/Market/73827535\", input: $input) {\n market {\n id\n handle\n status\n conditions {\n regionsCondition {\n regions(first: 10) {\n edges {\n node {\n id\n name\n }\n }\n }\n }\n }\n catalogs(first: 10) {\n edges {\n node {\n id\n }\n }\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n }`,\n \"variables\": {\n \"input\": {\n \"conditions\": {\n \"conditionsToAdd\": {\n \"regionsCondition\": {\n \"regions\": [\n {\n \"countryCode\": \"GB\"\n }\n ]\n }\n },\n \"conditionsToDelete\": {\n \"regionsCondition\": {\n \"regions\": [\n {\n \"countryCode\": \"US\"\n }\n ]\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 mutation marketUpdate($input: MarketUpdateInput!) {\n marketUpdate(id: \"gid://shopify/Market/73827535\", input: $input) {\n market {\n id\n handle\n status\n conditions {\n regionsCondition {\n regions(first: 10) {\n edges {\n node {\n id\n name\n }\n }\n }\n }\n }\n catalogs(first: 10) {\n edges {\n node {\n id\n }\n }\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n }\nQUERY\n\nvariables = {\n \"input\": {\n \"conditions\": {\n \"conditionsToAdd\": {\n \"regionsCondition\": {\n \"regions\": [{\"countryCode\"=>\"GB\"}]\n }\n },\n \"conditionsToDelete\": {\n \"regionsCondition\": {\n \"regions\": [{\"countryCode\"=>\"US\"}]\n }\n }\n }\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation marketUpdate($input: MarketUpdateInput!) {\n marketUpdate(id: \"gid://shopify/Market/73827535\", input: $input) {\n market {\n id\n handle\n status\n conditions {\n regionsCondition {\n regions(first: 10) {\n edges {\n node {\n id\n name\n }\n }\n }\n }\n }\n catalogs(first: 10) {\n edges {\n node {\n id\n }\n }\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n }`,\n {\n variables: {\n \"input\": {\n \"conditions\": {\n \"conditionsToAdd\": {\n \"regionsCondition\": {\n \"regions\": [\n {\n \"countryCode\": \"GB\"\n }\n ]\n }\n },\n \"conditionsToDelete\": {\n \"regionsCondition\": {\n \"regions\": [\n {\n \"countryCode\": \"US\"\n }\n ]\n }\n }\n }\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation marketUpdate($input: MarketUpdateInput!) {\n marketUpdate(id: \"gid://shopify/Market/73827535\", input: $input) {\n market {\n id\n handle\n status\n conditions {\n regionsCondition {\n regions(first: 10) {\n edges {\n node {\n id\n name\n }\n }\n }\n }\n }\n catalogs(first: 10) {\n edges {\n node {\n id\n }\n }\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n}" #### Graphql Input { "input": { "conditions": { "conditionsToAdd": { "regionsCondition": { "regions": [ { "countryCode": "GB" } ] } }, "conditionsToDelete": { "regionsCondition": { "regions": [ { "countryCode": "US" } ] } } } } } #### Graphql Response { "data": { "marketUpdate": { "market": { "id": "gid://shopify/Market/73827535", "handle": "us", "status": "ACTIVE", "conditions": { "regionsCondition": { "regions": { "edges": [ { "node": { "id": "gid://shopify/MarketRegionCountry/1072830634", "name": "United Kingdom" } } ] } } }, "catalogs": { "edges": [ { "node": { "id": "gid://shopify/MarketCatalog/73827535" } } ] } }, "userErrors": [] } } }