order
Returns an Order resource by ID.
Anchor to Possible returnsPossible returns
- Anchor to OrderOrder•
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 thescope to your app along with
or
. Private apps are not affected by this change and are automatically granted the scope.
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.
- Calculates a refund
- Get a list of orders using their IDs and GraphQL aliases
- Get a metafield attached to an order
- Get an order using the QueryRoot.node field and a GraphQL fragment
- Get metafields attached to an order
- Get pinned metafield definitions associated with an order
- Get sales agreements for an order
- Get sales agreements for order edits
- Get shipping lines for an order
- Preview a full duty refund
- Preview a proportional duty refund
- Retrieve a specific order
- Retrieve duties applied to an order
- Retrieves a count of an order's transactions
- Retrieves a count of fulfillments associated with a specific order
- Retrieves a list of all order risks for an order
- Retrieves a list of fulfillment orders for a specific order
- Retrieves a list of refunds for an order
- Retrieves a list of transactions
- Retrieves fulfillments associated with an order
- Retrieves tax related information for a given order
Examples
query SuggestedRefund($id: ID!, $refundLineItems: [RefundLineItemInput!]) {
order(id: $id) {
id
suggestedRefund(refundLineItems: $refundLineItems) {
subtotalSet {
shopMoney {
amount
currencyCode
}
presentmentMoney {
amount
currencyCode
}
}
refundLineItems {
lineItem {
id
}
quantity
}
}
}
}
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": "query SuggestedRefund($id: ID!, $refundLineItems: [RefundLineItemInput!]) { order(id: $id) { id suggestedRefund(refundLineItems: $refundLineItems) { subtotalSet { shopMoney { amount currencyCode } presentmentMoney { amount currencyCode } } refundLineItems { lineItem { id } quantity } } } }",
"variables": {
"id": "gid://shopify/Order/469306983",
"refundLineItems": [
{
"lineItemId": "gid://shopify/LineItem/983004162",
"quantity": 1
}
]
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
query SuggestedRefund($id: ID!, $refundLineItems: [RefundLineItemInput!]) {
order(id: $id) {
id
suggestedRefund(refundLineItems: $refundLineItems) {
subtotalSet {
shopMoney {
amount
currencyCode
}
presentmentMoney {
amount
currencyCode
}
}
refundLineItems {
lineItem {
id
}
quantity
}
}
}
}`,
{
variables: {
"id": "gid://shopify/Order/469306983",
"refundLineItems": [
{
"lineItemId": "gid://shopify/LineItem/983004162",
"quantity": 1
}
]
},
},
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `query SuggestedRefund($id: ID!, $refundLineItems: [RefundLineItemInput!]) {
order(id: $id) {
id
suggestedRefund(refundLineItems: $refundLineItems) {
subtotalSet {
shopMoney {
amount
currencyCode
}
presentmentMoney {
amount
currencyCode
}
}
refundLineItems {
lineItem {
id
}
quantity
}
}
}
}`,
"variables": {
"id": "gid://shopify/Order/469306983",
"refundLineItems": [
{
"lineItemId": "gid://shopify/LineItem/983004162",
"quantity": 1
}
]
},
},
});
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
query SuggestedRefund($id: ID!, $refundLineItems: [RefundLineItemInput!]) {
order(id: $id) {
id
suggestedRefund(refundLineItems: $refundLineItems) {
subtotalSet {
shopMoney {
amount
currencyCode
}
presentmentMoney {
amount
currencyCode
}
}
refundLineItems {
lineItem {
id
}
quantity
}
}
}
}
QUERY
variables = {
"id": "gid://shopify/Order/469306983",
"refundLineItems": [{"lineItemId"=>"gid://shopify/LineItem/983004162", "quantity"=>1}]
}
response = client.query(query: query, variables: variables)