# marketCreate - admin - MUTATION Version: unstable ## Description Creates a new market. ### Access Scopes `read_markets` for queries and both `read_markets` as well as `write_markets` for mutations. ## Arguments * [input](/docs/api/admin/unstable/input-objects/MarketCreateInput): MarketCreateInput! - The properties of the new market. ## 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 ### Create a B2B market for all company locations located in the United States 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 marketCreate($input: MarketCreateInput!) { marketCreate(input: $input) { market { id handle status conditions { companyLocationsCondition { companyLocations(first: 10) { edges { node { id } } } } } currencySettings { baseCurrency { currencyCode } localCurrencies } } userErrors { field message code } } }\",\n \"variables\": {\n \"input\": {\n \"name\": \"Company Location Market\",\n \"handle\": \"Company-Location\",\n \"enabled\": true,\n \"conditions\": {\n \"regionsCondition\": {\n \"regions\": [\n {\n \"countryCode\": \"US\"\n }\n ]\n },\n \"companyLocationsCondition\": {\n \"applicationLevel\": \"ALL\"\n }\n },\n \"currencySettings\": {\n \"baseCurrency\": \"USD\",\n \"localCurrencies\": false\n }\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation marketCreate($input: MarketCreateInput!) {\n marketCreate(input: $input) {\n market {\n id\n handle\n status\n conditions {\n companyLocationsCondition {\n companyLocations(first: 10) {\n edges {\n node {\n id\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 \"name\": \"Company Location Market\",\n \"handle\": \"Company-Location\",\n \"enabled\": true,\n \"conditions\": {\n \"regionsCondition\": {\n \"regions\": [\n {\n \"countryCode\": \"US\"\n }\n ]\n },\n \"companyLocationsCondition\": {\n \"applicationLevel\": \"ALL\"\n }\n },\n \"currencySettings\": {\n \"baseCurrency\": \"USD\",\n \"localCurrencies\": false\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 marketCreate($input: MarketCreateInput!) {\n marketCreate(input: $input) {\n market {\n id\n handle\n status\n conditions {\n companyLocationsCondition {\n companyLocations(first: 10) {\n edges {\n node {\n id\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 \"name\": \"Company Location Market\",\n \"handle\": \"Company-Location\",\n \"enabled\": true,\n \"conditions\": {\n \"regionsCondition\": {\n \"regions\": [{\"countryCode\"=>\"US\"}]\n },\n \"companyLocationsCondition\": {\n \"applicationLevel\": \"ALL\"\n }\n },\n \"currencySettings\": {\n \"baseCurrency\": \"USD\",\n \"localCurrencies\": false\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 marketCreate($input: MarketCreateInput!) {\n marketCreate(input: $input) {\n market {\n id\n handle\n status\n conditions {\n companyLocationsCondition {\n companyLocations(first: 10) {\n edges {\n node {\n id\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 \"name\": \"Company Location Market\",\n \"handle\": \"Company-Location\",\n \"enabled\": true,\n \"conditions\": {\n \"regionsCondition\": {\n \"regions\": [\n {\n \"countryCode\": \"US\"\n }\n ]\n },\n \"companyLocationsCondition\": {\n \"applicationLevel\": \"ALL\"\n }\n },\n \"currencySettings\": {\n \"baseCurrency\": \"USD\",\n \"localCurrencies\": false\n }\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation marketCreate($input: MarketCreateInput!) {\n marketCreate(input: $input) {\n market {\n id\n handle\n status\n conditions {\n companyLocationsCondition {\n companyLocations(first: 10) {\n edges {\n node {\n id\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": { "name": "Company Location Market", "handle": "Company-Location", "enabled": true, "conditions": { "regionsCondition": { "regions": [ { "countryCode": "US" } ] }, "companyLocationsCondition": { "applicationLevel": "ALL" } }, "currencySettings": { "baseCurrency": "USD", "localCurrencies": false } } } #### Graphql Response { "data": { "marketCreate": { "market": { "id": "gid://shopify/Market/1068177798", "handle": "company-location", "status": "ACTIVE", "conditions": { "companyLocationsCondition": { "companyLocations": { "edges": [] } } }, "currencySettings": { "baseCurrency": { "currencyCode": "USD" }, "localCurrencies": false } }, "userErrors": [] } } } ### Create a B2B market with a specific currency and price inclusions 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 marketCreate($input: MarketCreateInput!) { marketCreate(input: $input) { market { id handle status conditions { companyLocationsCondition { companyLocations(first: 10) { edges { node { id } } } } } currencySettings { baseCurrency { currencyCode } localCurrencies } } userErrors { field message code } } }\",\n \"variables\": {\n \"input\": {\n \"name\": \"Company Location Market\",\n \"handle\": \"company-location-market\",\n \"enabled\": true,\n \"conditions\": {\n \"companyLocationsCondition\": {\n \"companyLocationIds\": [\n \"gid://shopify/CompanyLocation/423757199\"\n ]\n }\n },\n \"currencySettings\": {\n \"baseCurrency\": \"USD\",\n \"localCurrencies\": false\n }\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation marketCreate($input: MarketCreateInput!) {\n marketCreate(input: $input) {\n market {\n id\n handle\n status\n conditions {\n companyLocationsCondition {\n companyLocations(first: 10) {\n edges {\n node {\n id\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 \"name\": \"Company Location Market\",\n \"handle\": \"company-location-market\",\n \"enabled\": true,\n \"conditions\": {\n \"companyLocationsCondition\": {\n \"companyLocationIds\": [\n \"gid://shopify/CompanyLocation/423757199\"\n ]\n }\n },\n \"currencySettings\": {\n \"baseCurrency\": \"USD\",\n \"localCurrencies\": false\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 marketCreate($input: MarketCreateInput!) {\n marketCreate(input: $input) {\n market {\n id\n handle\n status\n conditions {\n companyLocationsCondition {\n companyLocations(first: 10) {\n edges {\n node {\n id\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 \"name\": \"Company Location Market\",\n \"handle\": \"company-location-market\",\n \"enabled\": true,\n \"conditions\": {\n \"companyLocationsCondition\": {\n \"companyLocationIds\": [\"gid://shopify/CompanyLocation/423757199\"]\n }\n },\n \"currencySettings\": {\n \"baseCurrency\": \"USD\",\n \"localCurrencies\": false\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 marketCreate($input: MarketCreateInput!) {\n marketCreate(input: $input) {\n market {\n id\n handle\n status\n conditions {\n companyLocationsCondition {\n companyLocations(first: 10) {\n edges {\n node {\n id\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 \"name\": \"Company Location Market\",\n \"handle\": \"company-location-market\",\n \"enabled\": true,\n \"conditions\": {\n \"companyLocationsCondition\": {\n \"companyLocationIds\": [\n \"gid://shopify/CompanyLocation/423757199\"\n ]\n }\n },\n \"currencySettings\": {\n \"baseCurrency\": \"USD\",\n \"localCurrencies\": false\n }\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation marketCreate($input: MarketCreateInput!) {\n marketCreate(input: $input) {\n market {\n id\n handle\n status\n conditions {\n companyLocationsCondition {\n companyLocations(first: 10) {\n edges {\n node {\n id\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": { "name": "Company Location Market", "handle": "company-location-market", "enabled": true, "conditions": { "companyLocationsCondition": { "companyLocationIds": [ "gid://shopify/CompanyLocation/423757199" ] } }, "currencySettings": { "baseCurrency": "USD", "localCurrencies": false } } } #### Graphql Response { "data": { "marketCreate": { "market": { "id": "gid://shopify/Market/1068177800", "handle": "company-location-market", "status": "ACTIVE", "conditions": { "companyLocationsCondition": { "companyLocations": { "edges": [ { "node": { "id": "gid://shopify/CompanyLocation/423757199" } } ] } } }, "currencySettings": { "baseCurrency": { "currencyCode": "USD" }, "localCurrencies": false } }, "userErrors": [] } } } ### Create a North America market with a catalog and web presences 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 marketCreate($input: MarketCreateInput!) { marketCreate(input: $input) { market { id handle status conditions { regionsCondition { regions(first: 10) { edges { node { id name } } } } } catalogs(first: 10) { edges { node { id } } } webPresences(first: 10) { edges { node { domain { id } subfolderSuffix } } } } userErrors { field message code } } }\",\n \"variables\": {\n \"input\": {\n \"name\": \"North America Market\",\n \"handle\": \"NA\",\n \"enabled\": true,\n \"conditions\": {\n \"regionsCondition\": {\n \"regions\": [\n {\n \"countryCode\": \"US\"\n },\n {\n \"countryCode\": \"CA\"\n },\n {\n \"countryCode\": \"MX\"\n }\n ]\n }\n },\n \"catalogs\": [\n \"gid://shopify/Catalog/307400570\"\n ],\n \"webPresences\": [\n \"gid://shopify/MarketWebPresence/1068177692\"\n ]\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation marketCreate($input: MarketCreateInput!) {\n marketCreate(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 webPresences(first: 10) {\n edges {\n node {\n domain {\n id\n }\n subfolderSuffix\n }\n }\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n }`,\n \"variables\": {\n \"input\": {\n \"name\": \"North America Market\",\n \"handle\": \"NA\",\n \"enabled\": true,\n \"conditions\": {\n \"regionsCondition\": {\n \"regions\": [\n {\n \"countryCode\": \"US\"\n },\n {\n \"countryCode\": \"CA\"\n },\n {\n \"countryCode\": \"MX\"\n }\n ]\n }\n },\n \"catalogs\": [\n \"gid://shopify/Catalog/307400570\"\n ],\n \"webPresences\": [\n \"gid://shopify/MarketWebPresence/1068177692\"\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 marketCreate($input: MarketCreateInput!) {\n marketCreate(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 webPresences(first: 10) {\n edges {\n node {\n domain {\n id\n }\n subfolderSuffix\n }\n }\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n }\nQUERY\n\nvariables = {\n \"input\": {\n \"name\": \"North America Market\",\n \"handle\": \"NA\",\n \"enabled\": true,\n \"conditions\": {\n \"regionsCondition\": {\n \"regions\": [{\"countryCode\"=>\"US\"}, {\"countryCode\"=>\"CA\"}, {\"countryCode\"=>\"MX\"}]\n }\n },\n \"catalogs\": [\"gid://shopify/Catalog/307400570\"],\n \"webPresences\": [\"gid://shopify/MarketWebPresence/1068177692\"]\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 marketCreate($input: MarketCreateInput!) {\n marketCreate(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 webPresences(first: 10) {\n edges {\n node {\n domain {\n id\n }\n subfolderSuffix\n }\n }\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n }`,\n {\n variables: {\n \"input\": {\n \"name\": \"North America Market\",\n \"handle\": \"NA\",\n \"enabled\": true,\n \"conditions\": {\n \"regionsCondition\": {\n \"regions\": [\n {\n \"countryCode\": \"US\"\n },\n {\n \"countryCode\": \"CA\"\n },\n {\n \"countryCode\": \"MX\"\n }\n ]\n }\n },\n \"catalogs\": [\n \"gid://shopify/Catalog/307400570\"\n ],\n \"webPresences\": [\n \"gid://shopify/MarketWebPresence/1068177692\"\n ]\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation marketCreate($input: MarketCreateInput!) {\n marketCreate(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 webPresences(first: 10) {\n edges {\n node {\n domain {\n id\n }\n subfolderSuffix\n }\n }\n }\n }\n userErrors {\n field\n message\n code\n }\n }\n}" #### Graphql Input { "input": { "name": "North America Market", "handle": "NA", "enabled": true, "conditions": { "regionsCondition": { "regions": [ { "countryCode": "US" }, { "countryCode": "CA" }, { "countryCode": "MX" } ] } }, "catalogs": [ "gid://shopify/Catalog/307400570" ], "webPresences": [ "gid://shopify/MarketWebPresence/1068177692" ] } } #### Graphql Response { "data": { "marketCreate": { "market": { "id": "gid://shopify/Market/1068177801", "handle": "na", "status": "ACTIVE", "conditions": { "regionsCondition": { "regions": { "edges": [ { "node": { "id": "gid://shopify/MarketRegionCountry/397370199", "name": "United States" } }, { "node": { "id": "gid://shopify/MarketRegionCountry/948873163", "name": "Canada" } }, { "node": { "id": "gid://shopify/MarketRegionCountry/1072830732", "name": "Mexico" } } ] } } }, "catalogs": { "edges": [ { "node": { "id": "gid://shopify/MarketCatalog/307400570" } } ] }, "webPresences": { "edges": [ { "node": { "domain": { "id": "gid://shopify/Domain/1069626402" }, "subfolderSuffix": null } } ] } }, "userErrors": [] } } } ### Create a POS market for all locations 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 marketCreate($input: MarketCreateInput!) { marketCreate(input: $input) { market { id handle status conditions { locationsCondition { locations(first: 10) { edges { node { id } } } } } currencySettings { baseCurrency { currencyCode } localCurrencies } } userErrors { field message code } } }\",\n \"variables\": {\n \"input\": {\n \"name\": \"All POS Market\",\n \"handle\": \"all-pos-market\",\n \"enabled\": true,\n \"conditions\": {\n \"locationsCondition\": {\n \"applicationLevel\": \"ALL\"\n }\n },\n \"currencySettings\": {\n \"baseCurrency\": \"USD\",\n \"localCurrencies\": false\n }\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation marketCreate($input: MarketCreateInput!) {\n marketCreate(input: $input) {\n market {\n id\n handle\n status\n conditions {\n locationsCondition {\n locations(first: 10) {\n edges {\n node {\n id\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 \"name\": \"All POS Market\",\n \"handle\": \"all-pos-market\",\n \"enabled\": true,\n \"conditions\": {\n \"locationsCondition\": {\n \"applicationLevel\": \"ALL\"\n }\n },\n \"currencySettings\": {\n \"baseCurrency\": \"USD\",\n \"localCurrencies\": false\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 marketCreate($input: MarketCreateInput!) {\n marketCreate(input: $input) {\n market {\n id\n handle\n status\n conditions {\n locationsCondition {\n locations(first: 10) {\n edges {\n node {\n id\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 \"name\": \"All POS Market\",\n \"handle\": \"all-pos-market\",\n \"enabled\": true,\n \"conditions\": {\n \"locationsCondition\": {\n \"applicationLevel\": \"ALL\"\n }\n },\n \"currencySettings\": {\n \"baseCurrency\": \"USD\",\n \"localCurrencies\": false\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 marketCreate($input: MarketCreateInput!) {\n marketCreate(input: $input) {\n market {\n id\n handle\n status\n conditions {\n locationsCondition {\n locations(first: 10) {\n edges {\n node {\n id\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 \"name\": \"All POS Market\",\n \"handle\": \"all-pos-market\",\n \"enabled\": true,\n \"conditions\": {\n \"locationsCondition\": {\n \"applicationLevel\": \"ALL\"\n }\n },\n \"currencySettings\": {\n \"baseCurrency\": \"USD\",\n \"localCurrencies\": false\n }\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation marketCreate($input: MarketCreateInput!) {\n marketCreate(input: $input) {\n market {\n id\n handle\n status\n conditions {\n locationsCondition {\n locations(first: 10) {\n edges {\n node {\n id\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": { "name": "All POS Market", "handle": "all-pos-market", "enabled": true, "conditions": { "locationsCondition": { "applicationLevel": "ALL" } }, "currencySettings": { "baseCurrency": "USD", "localCurrencies": false } } } #### Graphql Response { "data": { "marketCreate": { "market": { "id": "gid://shopify/Market/1068177799", "handle": "all-pos-market", "status": "ACTIVE", "conditions": { "locationsCondition": { "locations": { "edges": [] } } }, "currencySettings": { "baseCurrency": { "currencyCode": "USD" }, "localCurrencies": false } }, "userErrors": [] } } }