@shopify/cli
Version:
A CLI tool to build for the Shopify platform
64 lines (61 loc) • 1.33 kB
text/typescript
// NOTE: https://shopify.dev/docs/api/customer/latest/objects/Order
export const ORDER_ITEM_FRAGMENT = `#graphql
fragment OrderItem on Order {
totalPrice {
amount
currencyCode
}
financialStatus
fulfillmentStatus
fulfillments(first: 1) {
nodes {
status
}
}
id
number
confirmationNumber
processedAt
}
` as const;
// NOTE: https://shopify.dev/docs/api/customer/latest/objects/Customer
export const CUSTOMER_ORDERS_FRAGMENT = `#graphql
fragment CustomerOrders on Customer {
orders(
sortKey: PROCESSED_AT,
reverse: true,
first: $first,
last: $last,
before: $startCursor,
after: $endCursor,
query: $query
) {
nodes {
...OrderItem
}
pageInfo {
hasPreviousPage
hasNextPage
endCursor
startCursor
}
}
}
${ORDER_ITEM_FRAGMENT}
` as const;
// NOTE: https://shopify.dev/docs/api/customer/latest/queries/customer
export const CUSTOMER_ORDERS_QUERY = `#graphql
${CUSTOMER_ORDERS_FRAGMENT}
query CustomerOrders(
$endCursor: String
$first: Int
$last: Int
$startCursor: String
$query: String
$language: LanguageCode
) @inContext(language: $language) {
customer {
...CustomerOrders
}
}
` as const;