orderquery
Returns an Order resource by ID.
Arguments
The ID of the Order to return.
Order possible returns
An order is a customer's request to purchase one or more products from a shop. You can retrieve and update orders using the
Order
object. Learn more about editing an existing order with the GraphQL Admin API.Only the last 60 days' worth of orders from a store are accessible from the
Order
object by default. If you want to access older orders, then you need to request access to all orders. If your app is granted access, then you can add theread
scope to your app along with_all _orders read
or_orders write
. Private apps are not affected by this change and are automatically granted the scope._orders Caution: Only use this data if it's required for your app's functionality. Shopify will restrict access to scopes for apps that don't have a legitimate use for the associated data.
Code examples for QUERY: order
Query Reference for QUERY: order
"{\n order(id) {\n # Order fields\n }\n}"
Input Reference for QUERY: order
Schema Reference for QUERY: order
Display Examples for QUERY: order
[ { "example": { "type_name": "order", "title": "Get a list of orders using their IDs and GraphQL aliases", "description": "The following query retrieves a list of orders using their IDs and GraphQL aliases, returning the order name for each alias.", "query_string": "query {\n order1: order(id: \"gid://shopify/Order/148977776\") {\n name\n }\n order2: order(id: \"gid://shopify/Order/1073459961\") {\n name\n }\n}", "query_arguments": { "id": "gid://shopify/Order/148977776" }, "response": { "data": { "order1": { "name": "#1001" }, "order2": { "name": "#1018" } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/sales/test/unit/graph_api/admin/order_test.rb", "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 { order1: order(id: \\\"gid://shopify/Order/148977776\\\") { name } order2: order(id: \\\"gid://shopify/Order/1073459961\\\") { name } }\"\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n order1: order(id: \"gid://shopify/Order/148977776\") {\n name\n }\n order2: order(id: \"gid://shopify/Order/1073459961\") {\n name\n }\n }`,\n);\n\nconst data = await response.json();\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 {\n order1: order(id: \"gid://shopify/Order/148977776\") {\n name\n }\n order2: order(id: \"gid://shopify/Order/1073459961\") {\n name\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n order1: order(id: \"gid://shopify/Order/148977776\") {\n name\n }\n order2: order(id: \"gid://shopify/Order/1073459961\") {\n name\n }\n }`,\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query {\n order1: order(id: \"gid://shopify/Order/148977776\") {\n name\n }\n order2: order(id: \"gid://shopify/Order/1073459961\") {\n name\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" }, "titleStringKey": "arguments", "inputVariableEntries": [ { "arg": { "name": "id", "description": "The ID of the Order to return.", "type": { "kind": "SCALAR", "name": "ID", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "ID!", "isDeprecated": false, "deprecationReason": null }, "key": "id", "argValue": " \"gid://shopify/Order/148977776\"", "typeKind": "QUERY" } ] }, { "example": { "type_name": "order", "title": "Get an order by its ID", "description": "The following query retrieves an order with its ID, returning the order name.", "query_string": "query {\n order(id: \"gid://shopify/Order/148977776\") {\n name\n }\n}", "query_arguments": { "id": "gid://shopify/Order/148977776" }, "response": { "data": { "order": { "name": "#1001" } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/sales/test/unit/graph_api/admin/order_test.rb", "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 { order(id: \\\"gid://shopify/Order/148977776\\\") { name } }\"\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n order(id: \"gid://shopify/Order/148977776\") {\n name\n }\n }`,\n);\n\nconst data = await response.json();\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 {\n order(id: \"gid://shopify/Order/148977776\") {\n name\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n order(id: \"gid://shopify/Order/148977776\") {\n name\n }\n }`,\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query {\n order(id: \"gid://shopify/Order/148977776\") {\n name\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" }, "titleStringKey": "arguments", "inputVariableEntries": [ { "arg": { "name": "id", "description": "The ID of the Order to return.", "type": { "kind": "SCALAR", "name": "ID", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "ID!", "isDeprecated": false, "deprecationReason": null }, "key": "id", "argValue": " \"gid://shopify/Order/148977776\"", "typeKind": "QUERY" } ] }, { "example": { "type_name": "order", "title": "Get sales agreements for an order", "description": "The following query shows how to retrieve the first 10 sales agreements for an order. The response body returns the initial sales agreement for the order and two corresponding sale records. One record is for ProductSale, which represents the line item for specific product sale. One record is for ShippingLineSale, which represents the line item for a shipping fee.", "query_string": "query {\n order(id: \"gid://shopify/Order/816964372\") {\n agreements(first: 10) {\n edges {\n node {\n id\n happenedAt\n sales(first: 10) {\n edges {\n node {\n actionType\n lineType\n quantity\n totalAmount {\n shopMoney {\n amount\n }\n }\n ... on ProductSale {\n lineItem {\n id\n name\n }\n }\n ... on ShippingLineSale {\n shippingLine {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n }\n}", "query_arguments": { "first": 10 }, "response": { "data": { "order": { "agreements": { "edges": [ { "node": { "id": "gid://shopify/SalesAgreement/466882664", "happenedAt": "2005-07-31T15:57:11Z", "sales": { "edges": [ { "node": { "actionType": "ORDER", "lineType": "SHIPPING", "quantity": null, "totalAmount": { "shopMoney": { "amount": "5.0" } }, "shippingLine": { "id": "gid://shopify/ShippingLine/816964372" } } }, { "node": { "actionType": "ORDER", "lineType": "PRODUCT", "quantity": 3, "totalAmount": { "shopMoney": { "amount": "30.0" } }, "lineItem": { "id": "gid://shopify/LineItem/406313524", "name": "Draft - 151cm" } } } ] } } } ] } } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/sales/test/unit/graph_api/admin/order_test.rb", "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 { order(id: \\\"gid://shopify/Order/816964372\\\") { agreements(first: 10) { edges { node { id happenedAt sales(first: 10) { edges { node { actionType lineType quantity totalAmount { shopMoney { amount } } ... on ProductSale { lineItem { id name } } ... on ShippingLineSale { shippingLine { id } } } } } } } } } }\"\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n order(id: \"gid://shopify/Order/816964372\") {\n agreements(first: 10) {\n edges {\n node {\n id\n happenedAt\n sales(first: 10) {\n edges {\n node {\n actionType\n lineType\n quantity\n totalAmount {\n shopMoney {\n amount\n }\n }\n ... on ProductSale {\n lineItem {\n id\n name\n }\n }\n ... on ShippingLineSale {\n shippingLine {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\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 {\n order(id: \"gid://shopify/Order/816964372\") {\n agreements(first: 10) {\n edges {\n node {\n id\n happenedAt\n sales(first: 10) {\n edges {\n node {\n actionType\n lineType\n quantity\n totalAmount {\n shopMoney {\n amount\n }\n }\n ... on ProductSale {\n lineItem {\n id\n name\n }\n }\n ... on ShippingLineSale {\n shippingLine {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n order(id: \"gid://shopify/Order/816964372\") {\n agreements(first: 10) {\n edges {\n node {\n id\n happenedAt\n sales(first: 10) {\n edges {\n node {\n actionType\n lineType\n quantity\n totalAmount {\n shopMoney {\n amount\n }\n }\n ... on ProductSale {\n lineItem {\n id\n name\n }\n }\n ... on ShippingLineSale {\n shippingLine {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }`,\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query {\n order(id: \"gid://shopify/Order/816964372\") {\n agreements(first: 10) {\n edges {\n node {\n id\n happenedAt\n sales(first: 10) {\n edges {\n node {\n actionType\n lineType\n quantity\n totalAmount {\n shopMoney {\n amount\n }\n }\n ... on ProductSale {\n lineItem {\n id\n name\n }\n }\n ... on ShippingLineSale {\n shippingLine {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" }, "titleStringKey": "arguments", "inputVariableEntries": [] }, { "example": { "type_name": "order", "title": "Get sales agreements for order edits", "description": "The following query retrieves the sales agreements for an order edit, where two units of one product are returned in exchange for two units of another product at the same price. The response includes the newly-added sales agreement for the edits to the order. The response includes two unique sale records. The product returned is indicated by \"quantity\": -2.", "query_string": "query {\n order(id: \"gid://shopify/Order/116757651\") {\n agreements(first: 10) {\n edges {\n node {\n id\n happenedAt\n sales(first: 10) {\n edges {\n node {\n actionType\n lineType\n quantity\n totalAmount {\n shopMoney {\n amount\n }\n }\n ... on ProductSale {\n lineItem {\n id\n name\n }\n }\n }\n }\n }\n }\n }\n }\n }\n}", "query_arguments": { "first": 10 }, "response": { "data": { "order": { "agreements": { "edges": [ { "node": { "id": "gid://shopify/SalesAgreement/621397082", "happenedAt": "2019-04-15T15:57:11Z", "sales": { "edges": [ { "node": { "actionType": "ORDER", "lineType": "PRODUCT", "quantity": 3, "totalAmount": { "shopMoney": { "amount": "31.05" } }, "lineItem": { "id": "gid://shopify/LineItem/114976433", "name": "Wall Climber - 158cm" } } }, { "node": { "actionType": "ORDER", "lineType": "PRODUCT", "quantity": 2, "totalAmount": { "shopMoney": { "amount": "20.7" } }, "lineItem": { "id": "gid://shopify/LineItem/763128379", "name": "Hill Zipper - 151cm" } } }, { "node": { "actionType": "ORDER", "lineType": "SHIPPING", "quantity": null, "totalAmount": { "shopMoney": { "amount": "5.0" } } } } ] } } }, { "node": { "id": "gid://shopify/SalesAgreement/731429684", "happenedAt": "2019-04-16T11:52:10Z", "sales": { "edges": [ { "node": { "actionType": "ORDER", "lineType": "PRODUCT", "quantity": 2, "totalAmount": { "shopMoney": { "amount": "38.28" } }, "lineItem": { "id": "gid://shopify/LineItem/1001351938", "name": "Custom Zebra" } } }, { "node": { "actionType": "RETURN", "lineType": "PRODUCT", "quantity": -2, "totalAmount": { "shopMoney": { "amount": "-20.7" } }, "lineItem": { "id": "gid://shopify/LineItem/114976433", "name": "Wall Climber - 158cm" } } }, { "node": { "actionType": "ORDER", "lineType": "PRODUCT", "quantity": 2, "totalAmount": { "shopMoney": { "amount": "20.7" } }, "lineItem": { "id": "gid://shopify/LineItem/763128379", "name": "Hill Zipper - 151cm" } } } ] } } } ] } } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/sales/test/unit/graph_api/admin/order_test.rb", "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 { order(id: \\\"gid://shopify/Order/116757651\\\") { agreements(first: 10) { edges { node { id happenedAt sales(first: 10) { edges { node { actionType lineType quantity totalAmount { shopMoney { amount } } ... on ProductSale { lineItem { id name } } } } } } } } } }\"\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n order(id: \"gid://shopify/Order/116757651\") {\n agreements(first: 10) {\n edges {\n node {\n id\n happenedAt\n sales(first: 10) {\n edges {\n node {\n actionType\n lineType\n quantity\n totalAmount {\n shopMoney {\n amount\n }\n }\n ... on ProductSale {\n lineItem {\n id\n name\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\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 {\n order(id: \"gid://shopify/Order/116757651\") {\n agreements(first: 10) {\n edges {\n node {\n id\n happenedAt\n sales(first: 10) {\n edges {\n node {\n actionType\n lineType\n quantity\n totalAmount {\n shopMoney {\n amount\n }\n }\n ... on ProductSale {\n lineItem {\n id\n name\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n order(id: \"gid://shopify/Order/116757651\") {\n agreements(first: 10) {\n edges {\n node {\n id\n happenedAt\n sales(first: 10) {\n edges {\n node {\n actionType\n lineType\n quantity\n totalAmount {\n shopMoney {\n amount\n }\n }\n ... on ProductSale {\n lineItem {\n id\n name\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }`,\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query {\n order(id: \"gid://shopify/Order/116757651\") {\n agreements(first: 10) {\n edges {\n node {\n id\n happenedAt\n sales(first: 10) {\n edges {\n node {\n actionType\n lineType\n quantity\n totalAmount {\n shopMoney {\n amount\n }\n }\n ... on ProductSale {\n lineItem {\n id\n name\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" }, "titleStringKey": "arguments", "inputVariableEntries": [] }, { "example": { "type_name": "order", "title": "Get shipping lines for an order", "description": "The following query retrieves the first 10 shipping lines for an order, including removed shipping lines.", "query_string": "query shippingLinesByOrder($id: ID!) {\n order(id: $id) {\n shippingLines(first: 10, includeRemovals: true) {\n edges {\n node {\n id\n title\n isRemoved\n }\n }\n }\n }\n}", "variables": { "id": "gid://shopify/Order/816964372" }, "response": { "data": { "order": { "shippingLines": { "edges": [ { "node": { "id": "gid://shopify/ShippingLine/816964372", "title": "Ground Service", "isRemoved": true } }, { "node": { "id": "gid://shopify/ShippingLine/1072813970", "title": "Some shipping charge", "isRemoved": false } } ] } } } }, "api_name": "admin", "minimum_api_version": "2024-04", "maximum_api_version": "unstable", "location": "/components/sales/test/unit/graph_api/admin/order_test.rb", "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 shippingLinesByOrder($id: ID!) { order(id: $id) { shippingLines(first: 10, includeRemovals: true) { edges { node { id title isRemoved } } } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/Order/816964372\"\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query shippingLinesByOrder($id: ID!) {\n order(id: $id) {\n shippingLines(first: 10, includeRemovals: true) {\n edges {\n node {\n id\n title\n isRemoved\n }\n }\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/Order/816964372\"\n },\n },\n);\n\nconst data = await response.json();\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 shippingLinesByOrder($id: ID!) {\n order(id: $id) {\n shippingLines(first: 10, includeRemovals: true) {\n edges {\n node {\n id\n title\n isRemoved\n }\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/Order/816964372\"\n}\n\nresponse = client.query(query: query, variables: variables)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query shippingLinesByOrder($id: ID!) {\n order(id: $id) {\n shippingLines(first: 10, includeRemovals: true) {\n edges {\n node {\n id\n title\n isRemoved\n }\n }\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/Order/816964372\"\n },\n },\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query shippingLinesByOrder($id: ID!) {\n order(id: $id) {\n shippingLines(first: 10, includeRemovals: true) {\n edges {\n node {\n id\n title\n isRemoved\n }\n }\n }\n }\n }\nQUERY;\n\n$variables = [\n \"id\" => \"gid://shopify/Order/816964372\",\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "arguments", "inputVariableEntries": [] }, { "example": { "type_name": "order", "title": "Preview a full duty refund", "description": "To preview a full duty refund, you do not need to include an order's line items in the suggestedRefund query.", "query_string": "query suggestedRefund {\n order(id: \"gid://shopify/Order/469306983\") {\n suggestedRefund(refundDuties: [{dutyId: \"gid://shopify/Duty/1064114503\", refundType: FULL}]) {\n refundDuties {\n amountSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n originalDuty {\n id\n }\n }\n totalDutiesSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n }\n }\n}", "query_arguments": { "id": "gid://shopify/Order/469306983" }, "response": { "data": { "order": { "suggestedRefund": { "refundDuties": [ { "amountSet": { "shopMoney": { "amount": "8.97", "currencyCode": "USD" } }, "originalDuty": { "id": "gid://shopify/Duty/1064114503" } } ], "totalDutiesSet": { "shopMoney": { "amount": "8.97", "currencyCode": "USD" } } } } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/sales/test/unit/graph_api/admin/order_test.rb", "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 suggestedRefund { order(id: \\\"gid://shopify/Order/469306983\\\") { suggestedRefund(refundDuties: [{dutyId: \\\"gid://shopify/Duty/1064114503\\\", refundType: FULL}]) { refundDuties { amountSet { shopMoney { amount currencyCode } } originalDuty { id } } totalDutiesSet { shopMoney { amount currencyCode } } } } }\"\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query suggestedRefund {\n order(id: \"gid://shopify/Order/469306983\") {\n suggestedRefund(refundDuties: [{dutyId: \"gid://shopify/Duty/1064114503\", refundType: FULL}]) {\n refundDuties {\n amountSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n originalDuty {\n id\n }\n }\n totalDutiesSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\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 suggestedRefund {\n order(id: \"gid://shopify/Order/469306983\") {\n suggestedRefund(refundDuties: [{dutyId: \"gid://shopify/Duty/1064114503\", refundType: FULL}]) {\n refundDuties {\n amountSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n originalDuty {\n id\n }\n }\n totalDutiesSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query suggestedRefund {\n order(id: \"gid://shopify/Order/469306983\") {\n suggestedRefund(refundDuties: [{dutyId: \"gid://shopify/Duty/1064114503\", refundType: FULL}]) {\n refundDuties {\n amountSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n originalDuty {\n id\n }\n }\n totalDutiesSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n }\n }\n }`,\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query suggestedRefund {\n order(id: \"gid://shopify/Order/469306983\") {\n suggestedRefund(refundDuties: [{dutyId: \"gid://shopify/Duty/1064114503\", refundType: FULL}]) {\n refundDuties {\n amountSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n originalDuty {\n id\n }\n }\n totalDutiesSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n }\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" }, "titleStringKey": "arguments", "inputVariableEntries": [ { "arg": { "name": "id", "description": "The ID of the Order to return.", "type": { "kind": "SCALAR", "name": "ID", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "ID!", "isDeprecated": false, "deprecationReason": null }, "key": "id", "argValue": " \"gid://shopify/Order/469306983\"", "typeKind": "QUERY" } ] }, { "example": { "type_name": "order", "title": "Preview a proportional duty refund", "description": "In the suggestedRefund query, include the the duty ID, the refund type, and the ID and quantity of the line items that you want to preview the refund for.", "query_string": "query suggestedRefund {\n order(id: \"gid://shopify/Order/469306983\") {\n suggestedRefund(refundLineItems: [{lineItemId: \"gid://shopify/LineItem/983004162\", quantity: 1}], refundDuties: [{dutyId: \"gid://shopify/Duty/1064114503\", refundType: PROPORTIONAL}]) {\n refundDuties {\n amountSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n originalDuty {\n id\n }\n }\n totalDutiesSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n }\n }\n}", "query_arguments": { "id": "gid://shopify/Order/469306983" }, "response": { "data": { "order": { "suggestedRefund": { "refundDuties": [ { "amountSet": { "shopMoney": { "amount": "8.97", "currencyCode": "USD" } }, "originalDuty": { "id": "gid://shopify/Duty/1064114503" } } ], "totalDutiesSet": { "shopMoney": { "amount": "8.97", "currencyCode": "USD" } } } } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/sales/test/unit/graph_api/admin/order_test.rb", "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 suggestedRefund { order(id: \\\"gid://shopify/Order/469306983\\\") { suggestedRefund(refundLineItems: [{lineItemId: \\\"gid://shopify/LineItem/983004162\\\", quantity: 1}], refundDuties: [{dutyId: \\\"gid://shopify/Duty/1064114503\\\", refundType: PROPORTIONAL}]) { refundDuties { amountSet { shopMoney { amount currencyCode } } originalDuty { id } } totalDutiesSet { shopMoney { amount currencyCode } } } } }\"\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query suggestedRefund {\n order(id: \"gid://shopify/Order/469306983\") {\n suggestedRefund(refundLineItems: [{lineItemId: \"gid://shopify/LineItem/983004162\", quantity: 1}], refundDuties: [{dutyId: \"gid://shopify/Duty/1064114503\", refundType: PROPORTIONAL}]) {\n refundDuties {\n amountSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n originalDuty {\n id\n }\n }\n totalDutiesSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\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 suggestedRefund {\n order(id: \"gid://shopify/Order/469306983\") {\n suggestedRefund(refundLineItems: [{lineItemId: \"gid://shopify/LineItem/983004162\", quantity: 1}], refundDuties: [{dutyId: \"gid://shopify/Duty/1064114503\", refundType: PROPORTIONAL}]) {\n refundDuties {\n amountSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n originalDuty {\n id\n }\n }\n totalDutiesSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query suggestedRefund {\n order(id: \"gid://shopify/Order/469306983\") {\n suggestedRefund(refundLineItems: [{lineItemId: \"gid://shopify/LineItem/983004162\", quantity: 1}], refundDuties: [{dutyId: \"gid://shopify/Duty/1064114503\", refundType: PROPORTIONAL}]) {\n refundDuties {\n amountSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n originalDuty {\n id\n }\n }\n totalDutiesSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n }\n }\n }`,\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query suggestedRefund {\n order(id: \"gid://shopify/Order/469306983\") {\n suggestedRefund(refundLineItems: [{lineItemId: \"gid://shopify/LineItem/983004162\", quantity: 1}], refundDuties: [{dutyId: \"gid://shopify/Duty/1064114503\", refundType: PROPORTIONAL}]) {\n refundDuties {\n amountSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n originalDuty {\n id\n }\n }\n totalDutiesSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n }\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" }, "titleStringKey": "arguments", "inputVariableEntries": [ { "arg": { "name": "id", "description": "The ID of the Order to return.", "type": { "kind": "SCALAR", "name": "ID", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "ID!", "isDeprecated": false, "deprecationReason": null }, "key": "id", "argValue": " \"gid://shopify/Order/469306983\"", "typeKind": "QUERY" } ] }, { "example": { "type_name": "order", "title": "Retrieve duties applied to an order", "description": "When you query an order, you can retrieve the total duties applied using the currentTotalDutiesSet field. If you want to retrieve the duties applied to each line item, then you can include the duties field on the lineItems connection.", "query_string": "query {\n order(id: \"gid://shopify/Order/469306983\") {\n currentTotalDutiesSet {\n shopMoney {\n amount\n }\n }\n lineItems(first: 10) {\n edges {\n node {\n id\n name\n refundableQuantity\n duties {\n id\n harmonizedSystemCode\n price {\n shopMoney {\n amount\n }\n }\n }\n }\n }\n }\n }\n}", "query_arguments": { "first": 10 }, "response": { "data": { "order": { "currentTotalDutiesSet": { "shopMoney": { "amount": "8.97" } }, "lineItems": { "edges": [ { "node": { "id": "gid://shopify/LineItem/983004162", "name": "Element - 151cm", "refundableQuantity": 1, "duties": [ { "id": "gid://shopify/Duty/1064114503", "harmonizedSystemCode": "91051930", "price": { "shopMoney": { "amount": "8.97" } } } ] } } ] } } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/sales/test/unit/graph_api/admin/order_test.rb", "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 { order(id: \\\"gid://shopify/Order/469306983\\\") { currentTotalDutiesSet { shopMoney { amount } } lineItems(first: 10) { edges { node { id name refundableQuantity duties { id harmonizedSystemCode price { shopMoney { amount } } } } } } } }\"\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n order(id: \"gid://shopify/Order/469306983\") {\n currentTotalDutiesSet {\n shopMoney {\n amount\n }\n }\n lineItems(first: 10) {\n edges {\n node {\n id\n name\n refundableQuantity\n duties {\n id\n harmonizedSystemCode\n price {\n shopMoney {\n amount\n }\n }\n }\n }\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\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 {\n order(id: \"gid://shopify/Order/469306983\") {\n currentTotalDutiesSet {\n shopMoney {\n amount\n }\n }\n lineItems(first: 10) {\n edges {\n node {\n id\n name\n refundableQuantity\n duties {\n id\n harmonizedSystemCode\n price {\n shopMoney {\n amount\n }\n }\n }\n }\n }\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n order(id: \"gid://shopify/Order/469306983\") {\n currentTotalDutiesSet {\n shopMoney {\n amount\n }\n }\n lineItems(first: 10) {\n edges {\n node {\n id\n name\n refundableQuantity\n duties {\n id\n harmonizedSystemCode\n price {\n shopMoney {\n amount\n }\n }\n }\n }\n }\n }\n }\n }`,\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query {\n order(id: \"gid://shopify/Order/469306983\") {\n currentTotalDutiesSet {\n shopMoney {\n amount\n }\n }\n lineItems(first: 10) {\n edges {\n node {\n id\n name\n refundableQuantity\n duties {\n id\n harmonizedSystemCode\n price {\n shopMoney {\n amount\n }\n }\n }\n }\n }\n }\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" }, "titleStringKey": "arguments", "inputVariableEntries": [] }, { "example": { "type_name": "order", "title": "Get an order using the QueryRoot.node field and a GraphQL fragment", "description": "The following query retrieves an order, including the order name.", "query_string": "query {\n node(id: \"gid://shopify/Order/148977776\") {\n id\n ... on Order {\n name\n }\n }\n}", "query_arguments": { "id": "gid://shopify/Order/148977776" }, "response": { "data": { "node": { "id": "gid://shopify/Order/148977776", "name": "#1001" } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/platform/admin/test/unit/graph_api/admin/query_root_test.rb", "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 { node(id: \\\"gid://shopify/Order/148977776\\\") { id ... on Order { name } } }\"\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n node(id: \"gid://shopify/Order/148977776\") {\n id\n ... on Order {\n name\n }\n }\n }`,\n);\n\nconst data = await response.json();\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 {\n node(id: \"gid://shopify/Order/148977776\") {\n id\n ... on Order {\n name\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n node(id: \"gid://shopify/Order/148977776\") {\n id\n ... on Order {\n name\n }\n }\n }`,\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query {\n node(id: \"gid://shopify/Order/148977776\") {\n id\n ... on Order {\n name\n }\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" }, "titleStringKey": "arguments", "inputVariableEntries": [ { "arg": { "name": "id", "description": "The ID of the Order to return.", "type": { "kind": "SCALAR", "name": "ID", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "ID!", "isDeprecated": false, "deprecationReason": null }, "key": "id", "argValue": " \"gid://shopify/Order/148977776\"", "typeKind": "QUERY" } ] } ]