Anchor to marketCreatemarket
marketCreate
mutation
Requires for queries and both
as well as
for mutations.
Creates a new market.
Anchor to Arguments
Arguments
- Anchor to inputinput•Market
Create requiredInput! The properties of the new market.
Was this section helpful?
Anchor to MarketCreatePayload returnsMarketCreatePayload returns
- Anchor to marketmarket•
The market object.
- Anchor to userErrorsuser•
Errors [MarketUser non-nullError!]! The list of errors that occurred from executing the mutation.
Was this section helpful?
- Create a B2B market for all company locations located in the United States
- Create a B2B market with a specific currency and price inclusions
- Create a North America market with a catalog and web presences
- Create a POS market for all locations
- marketCreate reference
Examples
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
}
}
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 -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
}
}
}
}'
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 data = await response.json();
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
}
}
},
},
});
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{
"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/1068177798",
"handle": "company-location",
"status": "ACTIVE",
"conditions": {
"companyLocationsCondition": {
"companyLocations": {
"edges": []
}
}
},
"currencySettings": {
"baseCurrency": {
"currencyCode": "USD"
},
"localCurrencies": false
}
},
"userErrors": []
}
}