# markets - admin-graphql - QUERY Version: 2024-10 ## Description The markets configured for the shop. ### Access Scopes `read_markets` for queries and both `read_markets` as well as `write_markets` for mutations. ## Arguments * [after](/docs/api/admin-graphql/2024-10/scalars/String): String - The elements that come after the specified [cursor](https://shopify.dev/api/usage/pagination-graphql). * [before](/docs/api/admin-graphql/2024-10/scalars/String): String - The elements that come before the specified [cursor](https://shopify.dev/api/usage/pagination-graphql). * [first](/docs/api/admin-graphql/2024-10/scalars/Int): Int - The first `n` elements from the [paginated list](https://shopify.dev/api/usage/pagination-graphql). * [last](/docs/api/admin-graphql/2024-10/scalars/Int): Int - The last `n` elements from the [paginated list](https://shopify.dev/api/usage/pagination-graphql). * [reverse](/docs/api/admin-graphql/2024-10/scalars/Boolean): Boolean - Reverse the order of the underlying list. ## Returns * [edges](/docs/api/admin-graphql/2024-10/objects/MarketEdge): MarketEdge! The connection between the node and its parent. Each edge contains a minimum of the edge's cursor and the node. * [nodes](/docs/api/admin-graphql/2024-10/objects/Market): Market! A list of nodes that are contained in MarketEdge. You can fetch data about an individual node, or you can follow the edges to fetch data about a collection of related nodes. At each node, you specify the fields that you want to retrieve. * [pageInfo](/docs/api/admin-graphql/2024-10/objects/PageInfo): PageInfo! An object that’s used to retrieve [cursor information](https://shopify.dev/api/usage/pagination-graphql) about the current page. ## Examples ### Get market web presences and their root URLs 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\": \"query Markets { markets(first: 4) { nodes { name webPresence { rootUrls { locale url } } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query Markets {\n markets(first: 4) {\n nodes {\n name\n webPresence {\n rootUrls {\n locale\n url\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 query Markets {\n markets(first: 4) {\n nodes {\n name\n webPresence {\n rootUrls {\n locale\n url\n }\n }\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query Markets {\n markets(first: 4) {\n nodes {\n name\n webPresence {\n rootUrls {\n locale\n url\n }\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query Markets {\n markets(first: 4) {\n nodes {\n name\n webPresence {\n rootUrls {\n locale\n url\n }\n }\n }\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "markets": { "nodes": [ { "name": "Canada", "webPresence": { "rootUrls": [ { "locale": "en", "url": "https://defaultglobal.com/en-ca" }, { "locale": "fr", "url": "https://defaultglobal.com/fr-ca" } ] } }, { "name": "European Union", "webPresence": { "rootUrls": [ { "locale": "en", "url": "https://defaultglobal.com/en-eu" }, { "locale": "es", "url": "https://defaultglobal.com/es-eu" }, { "locale": "fr", "url": "https://defaultglobal.com/fr-eu" } ] } }, { "name": "United Kingdom", "webPresence": { "rootUrls": [ { "locale": "en", "url": "https://uk.defaultglobal.com" } ] } }, { "name": "United States", "webPresence": { "rootUrls": [ { "locale": "en", "url": "https://defaultglobal.com" }, { "locale": "es", "url": "https://defaultglobal.com/es" } ] } } ] } } } ### Get the first four markets 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\": \"query Markets { markets(first: 4) { nodes { id name regions(first: 2) { pageInfo { hasNextPage } nodes { name ... on MarketRegionCountry { code } } } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query Markets {\n markets(first: 4) {\n nodes {\n id\n name\n regions(first: 2) {\n pageInfo {\n hasNextPage\n }\n nodes {\n name\n ... on MarketRegionCountry {\n code\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 query Markets {\n markets(first: 4) {\n nodes {\n id\n name\n regions(first: 2) {\n pageInfo {\n hasNextPage\n }\n nodes {\n name\n ... on MarketRegionCountry {\n code\n }\n }\n }\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query Markets {\n markets(first: 4) {\n nodes {\n id\n name\n regions(first: 2) {\n pageInfo {\n hasNextPage\n }\n nodes {\n name\n ... on MarketRegionCountry {\n code\n }\n }\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query Markets {\n markets(first: 4) {\n nodes {\n id\n name\n regions(first: 2) {\n pageInfo {\n hasNextPage\n }\n nodes {\n name\n ... on MarketRegionCountry {\n code\n }\n }\n }\n }\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "markets": { "nodes": [ { "id": "gid://shopify/Market/249692835", "name": "Canada", "regions": { "pageInfo": { "hasNextPage": false }, "nodes": [ { "name": "Canada", "code": "CA" } ] } }, { "id": "gid://shopify/Market/58345162", "name": "European Union", "regions": { "pageInfo": { "hasNextPage": true }, "nodes": [ { "name": "Germany", "code": "DE" }, { "name": "Belgium", "code": "BE" } ] } }, { "id": "gid://shopify/Market/867658238", "name": "United Kingdom", "regions": { "pageInfo": { "hasNextPage": false }, "nodes": [ { "name": "United Kingdom", "code": "GB" } ] } }, { "id": "gid://shopify/Market/371343838", "name": "United States", "regions": { "pageInfo": { "hasNextPage": false }, "nodes": [ { "name": "United States", "code": "US" } ] } } ] } } }