Skip to content

Instantly share code, notes, and snippets.

@etherealite
Created August 7, 2022 19:59
Show Gist options
  • Save etherealite/074966a3512a9cf92f0c1237ef367e8b to your computer and use it in GitHub Desktop.
Save etherealite/074966a3512a9cf92f0c1237ef367e8b to your computer and use it in GitHub Desktop.
Shopify Inventory Adjustment
query InventoryAdjustments($first: Int, $last: Int, $after: String, $before: String, $locationId: ID, $variantId: ID) {
location(id: $locationId) {
id
name
__typename
}
inventoryHistory(
first: $first
last: $last
after: $after
before: $before
locationId: $locationId
variantId: $variantId
) {
edges {
node {
id
createdAt
reason
staffMember {
id
name
__typename
}
app {
id
title
__typename
}
referenceDocumentObject {
__typename
... on Order {
id
name
__typename
}
... on Location {
id
name
__typename
}
... on InventoryTransfer {
id
name
__typename
}
... on InventoryMovement {
id
name
__typename
}
... on PurchaseOrder {
id
name
__typename
}
... on Refund {
id
returnName
order {
id
name
__typename
}
__typename
}
}
changes(locationId: $locationId, variantId: $variantId) {
name
quantityAfterChange
delta
__typename
}
__typename
}
cursor
__typename
}
pageInfo {
hasNextPage
hasPreviousPage
__typename
}
__typename
}
}
@etherealite
Copy link
Author

etherealite commented Aug 7, 2022

Sample parameters for this query

  "after": "eyJsYXN0X2lkIjoxMjIyMjA1NDcyNzcwMywibGFzdF92YWx1ZSI6IjIwMjItMDUtMzEgMTU6Mjk6MTguNDUyMjM1In0=",
  "first": 50,
  "locationId": "gid://shopify/Location/2424266265242",
  "variantId": "gid://shopify/ProductVariant/25266434242"
}

GIDs are redacted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment