Fluent Commerce Logo
Docs
Sign In

GraphQL All-In-One Inventory Queries

Essential knowledge

Author:

Holger Lierse

Changed on:

1 July 2024

Overview

Retrieve inventory position, variant product, virtual base position and virtual aggregate position records based on input parameters.


Key points

  • Sample GraphQL query that extracts inventory position, variant product, virtual position and virtual aggregate position. 

Inventory Position, Variant Product, Virtual Base & Aggregate Position

Retrieve inventory position, variant product, virtual base position and virtual aggregate position records based on input parameters.

Example Query:

1query QueryInventoryWithProducts($inventoryCatalogueRef: String!,
2  $productCatalogueRef: String!,
3  $baseVirtualCatalogueRef: String!,
4  $aggregateVirtualCatalogueRef: String!,
5  $productRefs:[String!],
6  $locationRefs:[String!]) {
7  inventoryPositions(catalogue: {ref: $inventoryCatalogueRef}, productRef: $productRefs, locationRef:$locationRefs) {
8    edges {
9      node {
10        ref
11        status
12        productRef
13        locationRef
14        onHand
15      }
16    }
17  }
18  locations(ref:$locationRefs){
19    edges{
20      node{
21        ref
22        status
23      }
24    }
25  } 
26  variantProducts(catalogue:{ref:$productCatalogueRef} ref:$productRefs) {
27    edges {
28      node {
29        ref
30        status
31        name
32      }
33    }
34  }
35  base:virtualPositions(catalogue:{ref:$baseVirtualCatalogueRef} productRef:$productRefs, type:"BASE", groupRef:$locationRefs) {
36    edges {
37      node {
38        ref
39        status
40        quantity
41        type
42      }
43    }
44  }
45  ats:virtualPositions(catalogue:{ref:$aggregateVirtualCatalogueRef} productRef:$productRefs, type:"AGGREGATE") {
46    edges {
47      node {
48        ref
49        status
50        quantity
51        type
52      }
53    }
54  }
55}

Language: json

Name: Inventory with Products - Query

Description:

Inventory with Products - Query

Example Parameters:

1
2{
3  "inventoryCatalogueRef": "DEFAULT:1",
4  "productCatalogueRef": "COMPATIBILITY:1",
5  "baseVirtualCatalogueRef": "BASE:1",
6  "productRefs": ["20773500011"],
7  "aggregateVirtualCatalogueRef": "GP_RETAILER_HD:1",
8  "locationRefs": ["0952"]
9}

Language: json

Name: Inventory with Products - Parameter

Description:

Inventory with Products - Parameter