--- title: marketCreate - GraphQL Admin description: Creates a new market. api_version: 2025-04 api_name: admin type: mutation api_type: graphql source_url: html: 'https://shopify.dev/docs/api/admin-graphql/2025-04/mutations/marketCreate' md: 'https://shopify.dev/docs/api/admin-graphql/2025-04/mutations/marketCreate.md' --- # market​Create mutation Requires `read_markets` for queries and both `read_markets` as well as `write_markets` for mutations. Creates a new market. ## Arguments * input [Market​Create​Input!](https://shopify.dev/docs/api/admin-graphql/2025-04/input-objects/MarketCreateInput) required The properties of the new market. *** ## Market​Create​Payload returns * market [Market](https://shopify.dev/docs/api/admin-graphql/2025-04/objects/Market) The market object. * user​Errors [\[Market​User​Error!\]!](https://shopify.dev/docs/api/admin-graphql/2025-04/objects/MarketUserError) non-null The list of errors that occurred from executing the mutation. *** ## Examples * ### Create a B2B market for all company locations located in the United States #### Description Create a B2B market for all company locations located in the United States. The market includes all existing and future company locations located in the United States. This market type is currently only available in the dev preview. #### Query ```graphql 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 } } } ``` #### Variables ```json { "input": { "name": "Company Location Market", "handle": "Company-Location", "enabled": true, "conditions": { "regionsCondition": { "regions": [ { "countryCode": "US" } ] }, "companyLocationsCondition": { "applicationLevel": "ALL" } }, "currencySettings": { "baseCurrency": "USD", "localCurrencies": false } } } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/2025-04/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "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 } } }", "variables": { "input": { "name": "Company Location Market", "handle": "Company-Location", "enabled": true, "conditions": { "regionsCondition": { "regions": [ { "countryCode": "US" } ] }, "companyLocationsCondition": { "applicationLevel": "ALL" } }, "currencySettings": { "baseCurrency": "USD", "localCurrencies": false } } } }' ``` #### React Router ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql 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 } } }`, { variables: { "input": { "name": "Company Location Market", "handle": "Company-Location", "enabled": true, "conditions": { "regionsCondition": { "regions": [ { "countryCode": "US" } ] }, "companyLocationsCondition": { "applicationLevel": "ALL" } }, "currencySettings": { "baseCurrency": "USD", "localCurrencies": false } } }, }, ); const json = await response.json(); return json.data; } ``` #### Ruby ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Graphql::Admin.new( session: session ) query = <<~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 } } } QUERY variables = { "input": { "name": "Company Location Market", "handle": "Company-Location", "enabled": true, "conditions": { "regionsCondition": { "regions": [ { "countryCode": "US" } ] }, "companyLocationsCondition": { "applicationLevel": "ALL" } }, "currencySettings": { "baseCurrency": "USD", "localCurrencies": false } } } response = client.query(query: query, variables: variables) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "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 } } }`, "variables": { "input": { "name": "Company Location Market", "handle": "Company-Location", "enabled": true, "conditions": { "regionsCondition": { "regions": [ { "countryCode": "US" } ] }, "companyLocationsCondition": { "applicationLevel": "ALL" } }, "currencySettings": { "baseCurrency": "USD", "localCurrencies": false } } }, }, }); ``` #### Response ```json { "marketCreate": { "market": { "id": "gid://shopify/Market/1068177656", "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 #### Description Create a B2B market for a specific company location with a specific currency and price inclusions. This market type is currently only available in the dev preview. #### Query ```graphql 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 } } } ``` #### Variables ```json { "input": { "name": "Company Location Market", "handle": "company-location-market", "enabled": true, "conditions": { "companyLocationsCondition": { "companyLocationIds": [ "gid://shopify/CompanyLocation/423757199" ] } }, "currencySettings": { "baseCurrency": "USD", "localCurrencies": false } } } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/2025-04/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "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 } } }", "variables": { "input": { "name": "Company Location Market", "handle": "company-location-market", "enabled": true, "conditions": { "companyLocationsCondition": { "companyLocationIds": [ "gid://shopify/CompanyLocation/423757199" ] } }, "currencySettings": { "baseCurrency": "USD", "localCurrencies": false } } } }' ``` #### React Router ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql 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 } } }`, { variables: { "input": { "name": "Company Location Market", "handle": "company-location-market", "enabled": true, "conditions": { "companyLocationsCondition": { "companyLocationIds": [ "gid://shopify/CompanyLocation/423757199" ] } }, "currencySettings": { "baseCurrency": "USD", "localCurrencies": false } } }, }, ); const json = await response.json(); return json.data; } ``` #### Ruby ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Graphql::Admin.new( session: session ) query = <<~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 } } } QUERY variables = { "input": { "name": "Company Location Market", "handle": "company-location-market", "enabled": true, "conditions": { "companyLocationsCondition": { "companyLocationIds": [ "gid://shopify/CompanyLocation/423757199" ] } }, "currencySettings": { "baseCurrency": "USD", "localCurrencies": false } } } response = client.query(query: query, variables: variables) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "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 } } }`, "variables": { "input": { "name": "Company Location Market", "handle": "company-location-market", "enabled": true, "conditions": { "companyLocationsCondition": { "companyLocationIds": [ "gid://shopify/CompanyLocation/423757199" ] } }, "currencySettings": { "baseCurrency": "USD", "localCurrencies": false } } }, }, }); ``` #### Response ```json { "marketCreate": { "market": { "id": "gid://shopify/Market/1068177655", "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 #### Description Create a region market matching buyers located in the United States, Canada, and Mexico. #### Query ```graphql 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 } } } ``` #### Variables ```json { "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/1068177655" ] } } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/2025-04/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "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 } } }", "variables": { "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/1068177655" ] } } }' ``` #### React Router ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql 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 } } }`, { variables: { "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/1068177655" ] } }, }, ); const json = await response.json(); return json.data; } ``` #### Ruby ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Graphql::Admin.new( session: session ) query = <<~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 } } } QUERY variables = { "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/1068177655" ] } } response = client.query(query: query, variables: variables) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "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 } } }`, "variables": { "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/1068177655" ] } }, }, }); ``` #### Response ```json { "marketCreate": { "market": { "id": "gid://shopify/Market/1068177654", "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/1072830589", "name": "Mexico" } } ] } } }, "catalogs": { "edges": [ { "node": { "id": "gid://shopify/MarketCatalog/307400570" } } ] }, "webPresences": { "edges": [ { "node": { "domain": { "id": "gid://shopify/Domain/1071590560" }, "subfolderSuffix": null } } ] } }, "userErrors": [] } } ``` * ### Create a POS market for all locations #### Description Create a POS market for all locations. The market includes all existing and future locations. This market type is currently only available in the dev preview. #### Query ```graphql 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 } } } ``` #### Variables ```json { "input": { "name": "All POS Market", "handle": "all-pos-market", "enabled": true, "conditions": { "regionsCondition": { "regions": [ { "countryCode": "US" } ] }, "locationsCondition": { "applicationLevel": "ALL" } }, "currencySettings": { "baseCurrency": "USD", "localCurrencies": false } } } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/2025-04/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "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 } } }", "variables": { "input": { "name": "All POS Market", "handle": "all-pos-market", "enabled": true, "conditions": { "regionsCondition": { "regions": [ { "countryCode": "US" } ] }, "locationsCondition": { "applicationLevel": "ALL" } }, "currencySettings": { "baseCurrency": "USD", "localCurrencies": false } } } }' ``` #### React Router ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql 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 } } }`, { variables: { "input": { "name": "All POS Market", "handle": "all-pos-market", "enabled": true, "conditions": { "regionsCondition": { "regions": [ { "countryCode": "US" } ] }, "locationsCondition": { "applicationLevel": "ALL" } }, "currencySettings": { "baseCurrency": "USD", "localCurrencies": false } } }, }, ); const json = await response.json(); return json.data; } ``` #### Ruby ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Graphql::Admin.new( session: session ) query = <<~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 } } } QUERY variables = { "input": { "name": "All POS Market", "handle": "all-pos-market", "enabled": true, "conditions": { "regionsCondition": { "regions": [ { "countryCode": "US" } ] }, "locationsCondition": { "applicationLevel": "ALL" } }, "currencySettings": { "baseCurrency": "USD", "localCurrencies": false } } } response = client.query(query: query, variables: variables) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "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 } } }`, "variables": { "input": { "name": "All POS Market", "handle": "all-pos-market", "enabled": true, "conditions": { "regionsCondition": { "regions": [ { "countryCode": "US" } ] }, "locationsCondition": { "applicationLevel": "ALL" } }, "currencySettings": { "baseCurrency": "USD", "localCurrencies": false } } }, }, }); ``` #### Response ```json { "marketCreate": { "market": { "id": "gid://shopify/Market/1068177657", "handle": "all-pos-market", "status": "ACTIVE", "conditions": { "locationsCondition": { "locations": { "edges": [] } } }, "currencySettings": { "baseCurrency": { "currencyCode": "USD" }, "localCurrencies": false } }, "userErrors": [] } } ``` * ### marketCreate reference [Open in GraphiQL](http://localhost:3457/graphiql?query=mutation%20marketCreate\(%24input%3A%20MarketCreateInput!\)%20%7B%0A%20%20marketCreate\(input%3A%20%24input\)%20%7B%0A%20%20%20%20market%20%7B%0A%20%20%20%20%20%20id%0A%20%20%20%20%20%20handle%0A%20%20%20%20%20%20status%0A%20%20%20%20%20%20conditions%20%7B%0A%20%20%20%20%20%20%20%20companyLocationsCondition%20%7B%0A%20%20%20%20%20%20%20%20%20%20companyLocations\(first%3A%2010\)%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20edges%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20node%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20id%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20currencySettings%20%7B%0A%20%20%20%20%20%20%20%20baseCurrency%20%7B%0A%20%20%20%20%20%20%20%20%20%20currencyCode%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20localCurrencies%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%20%20%20%20userErrors%20%7B%0A%20%20%20%20%20%20field%0A%20%20%20%20%20%20message%0A%20%20%20%20%20%20code%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D\&variables=%7B%0A%20%20%22input%22%3A%20%7B%0A%20%20%20%20%22name%22%3A%20%22Company%20Location%20Market%22%2C%0A%20%20%20%20%22handle%22%3A%20%22Company-Location%22%2C%0A%20%20%20%20%22enabled%22%3A%20true%2C%0A%20%20%20%20%22conditions%22%3A%20%7B%0A%20%20%20%20%20%20%22regionsCondition%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22regions%22%3A%20%5B%0A%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22countryCode%22%3A%20%22US%22%0A%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%22companyLocationsCondition%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22applicationLevel%22%3A%20%22ALL%22%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%22currencySettings%22%3A%20%7B%0A%20%20%20%20%20%20%22baseCurrency%22%3A%20%22USD%22%2C%0A%20%20%20%20%20%20%22localCurrencies%22%3A%20false%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D) ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql 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 } } }`, { variables: { "input": { "name": "Company Location Market", "handle": "Company-Location", "enabled": true, "conditions": { "regionsCondition": { "regions": [ { "countryCode": "US" } ] }, "companyLocationsCondition": { "applicationLevel": "ALL" } }, "currencySettings": { "baseCurrency": "USD", "localCurrencies": false } } }, }, ); const json = await response.json(); return json.data; } ``` ##### GQL ``` 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 } } } ``` ##### cURL ``` curl -X POST \ https://your-development-store.myshopify.com/admin/api/2025-04/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "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 } } }", "variables": { "input": { "name": "Company Location Market", "handle": "Company-Location", "enabled": true, "conditions": { "regionsCondition": { "regions": [ { "countryCode": "US" } ] }, "companyLocationsCondition": { "applicationLevel": "ALL" } }, "currencySettings": { "baseCurrency": "USD", "localCurrencies": false } } } }' ``` ##### React Router ``` import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql 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 } } }`, { variables: { "input": { "name": "Company Location Market", "handle": "Company-Location", "enabled": true, "conditions": { "regionsCondition": { "regions": [ { "countryCode": "US" } ] }, "companyLocationsCondition": { "applicationLevel": "ALL" } }, "currencySettings": { "baseCurrency": "USD", "localCurrencies": false } } }, }, ); const json = await response.json(); return json.data; } ``` ##### Node.js ``` const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "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 } } }`, "variables": { "input": { "name": "Company Location Market", "handle": "Company-Location", "enabled": true, "conditions": { "regionsCondition": { "regions": [ { "countryCode": "US" } ] }, "companyLocationsCondition": { "applicationLevel": "ALL" } }, "currencySettings": { "baseCurrency": "USD", "localCurrencies": false } } }, }, }); ``` ##### Ruby ``` session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Graphql::Admin.new( session: session ) query = <<~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 } } } QUERY variables = { "input": { "name": "Company Location Market", "handle": "Company-Location", "enabled": true, "conditions": { "regionsCondition": { "regions": [ { "countryCode": "US" } ] }, "companyLocationsCondition": { "applicationLevel": "ALL" } }, "currencySettings": { "baseCurrency": "USD", "localCurrencies": false } } } response = client.query(query: query, variables: variables) ``` ## Input variables JSON ```json { "input": { "name": "Company Location Market", "handle": "Company-Location", "enabled": true, "conditions": { "regionsCondition": { "regions": [ { "countryCode": "US" } ] }, "companyLocationsCondition": { "applicationLevel": "ALL" } }, "currencySettings": { "baseCurrency": "USD", "localCurrencies": false } } } ``` ## Response JSON ```json { "marketCreate": { "market": { "id": "gid://shopify/Market/1068177656", "handle": "company-location", "status": "ACTIVE", "conditions": { "companyLocationsCondition": { "companyLocations": { "edges": [] } } }, "currencySettings": { "baseCurrency": { "currencyCode": "USD" }, "localCurrencies": false } }, "userErrors": [] } } ```