Once a purchase is completed, you can retrieve details of the order using orderByID
. The costs related to the order as well as the Cart
that the order was checked out from are all available to you. This is especially helpful when you need to build dashboards or populate order history pages.
Example
query OrderById($id: ID!) {
orderByID(id: $id) {
id
status
tax {
displayValue
}
shipping {
displayValue
}
subtotal {
displayValue
}
total {
value
currency
displayValue
}
cart {
id
attributes {
key
value
}
buyerIdentity {
firstName
lastName
email
phone
address1
address2
city
provinceCode
countryCode
postalCode
}
stores {
... on AmazonStore {
store
cartLines {
product {
title
images {
url
}
}
}
}
... on ShopifyStore {
store
cartLines {
variant {
name
title
SKU
image {
url
}
}
product {
title
productType
description
descriptionHTML
images {
url
}
}
}
}
}
}
events {
__typename
id
createdAt
}
}
}