# Queries / Products

# Products

**Query**
## futureCosts — Returns [[FutureCost]](/documentation/Objects/Products#FutureCost)

**Scopes required:** see_products

| Arguments | Type | Description |
| --- | --- | --- |
| products | [[ID]](/documentation/Types/UUID#UUID) | The products to get the future costs for (this will be in addition to any supplied families) |
| families | [[ID!]](/documentation/Types/UUID#UUID) | The families to get the future costs for (this will be in addition to any supplied products) |
| category | [ID](/documentation/Types/UUID#UUID) | The category to get the future costs for |
| startDate | [DateTime](/documentation/Types/Date-Time#DateTime) | The start date time to get the future costs of |
| endDate | [DateTime](/documentation/Types/Date-Time#DateTime) | The end date time to get the future costs of |
| outlet | [ID](/documentation/Types/UUID#UUID) | The outlet to get the future costs for (if null provided, global costs will be returned) |
| after | [Cursor](/documentation/Types/Cursor#Cursor) | The cursor to search after |
| first | *Int* | Maximum number of items to return |
| ordering | [Ordering](/documentation/Types/Ordering#Ordering) | The ordering to apply |

**Example Query**

```graphql
query GetFutureCosts($products: [ID]) {
    futureCosts(products: $products) {
        id,
        cost,
        effectiveTime
    }
}

# Example variables
{
    "products": [
        "<PRODUCTS>"
    ]
}
```

**Query**
## futurePrices — Returns [ConnectionType](/documentation/General/Connections) of [FuturePrice](/documentation/Objects/Products#FuturePrice)

**Scopes required:** see_products

### Sortable Fields
*Fields from [FuturePrice](/documentation/Objects/Products#FuturePrice) that can be used to sort the connection items*

- quantity
- effectiveTime
- name

| Arguments | Type | Description |
| --- | --- | --- |
| priceSetId | [ID](/documentation/Types/UUID#UUID) | The price set to retrieve the future prices for |
| products | [[ID]](/documentation/Types/UUID#UUID) | The products to get the future prices for (this will be in addition to any supplied families) |
| families | [[ID!]](/documentation/Types/UUID#UUID) | The families to get the future costs for (this will be in addition to any supplied products) |
| category | [ID](/documentation/Types/UUID#UUID) | The category to get the future prices for |
| startDate | [DateTime](/documentation/Types/Date-Time#DateTime) | The start date time to get the future prices of |
| endDate | [DateTime](/documentation/Types/Date-Time#DateTime) | The end date time to get the future prices of |
| createdBy | [[ID!]](/documentation/Types/UUID#UUID) | The users who created the future prices |
| search | *String* | A string to search the items by name this will automatically split on spaces to find approximate matches |

**Example Query**

```graphql
query GetFuturePrices($priceSetId: ID) {
    futurePrices(priceSetId: $priceSetId) {
        edges {
            node {
                id,
                quantity,
                price,
                priceEx,
                effectiveTime
            }
        },
        pageInfo {
            hasNextPage,
            endCursor
        }
    }
}

# Example variables
{
    "priceSetId": "<PRICE_SET_ID>"
}
```

**Query**
## inventoryLog — Returns [ConnectionType](/documentation/General/Connections) of [InventoryLog](/documentation/Objects/Inventory-Log#InventoryLog)

**Scopes required:** see_products

### Sortable Fields
*Fields from [InventoryLog](/documentation/Objects/Inventory-Log#InventoryLog) that can be used to sort the connection items*

- timestamp

| Arguments | Type | Description |
| --- | --- | --- |
| id | [ID!](/documentation/Types/UUID#UUID) | The ID of the product to get the inventory log of |
| type | [[InventoryLogChangeTypeEnum]](/documentation/Enums/Inventory-Log-Change-Type-Enum#InventoryLogChangeTypeEnum) | The type of change that occurred to look for |
| users | [[ID]](/documentation/Types/UUID#UUID) | A list of users that made modifications to filter by |
| outlet | [ID](/documentation/Types/UUID#UUID) | An outlet to filter the results by |
| start | [DateTime](/documentation/Types/Date-Time#DateTime) | Get any log that occurred after this parameter (inclusive) |
| end | [DateTime](/documentation/Types/Date-Time#DateTime) | Get any log that occurred before this parameter (exclusive) |

**Example Query**

```graphql
query GetInventoryLog($id: ID!) {
    inventoryLog(id: $id) {
        edges {
            node {
                before,
                changed,
                after,
                caseQuantity,
                averageCost
            }
        },
        pageInfo {
            hasNextPage,
            endCursor
        }
    }
}

# Example variables
{
    "id": "<ID>"
}
```

**Query**
## product — Returns [Product](/documentation/Objects/Products#Product)

**Scopes required:** see_products

| Arguments | Type | Description |
| --- | --- | --- |
| id | [ID!](/documentation/Types/UUID#UUID) | The ID of the product to retrieve |

**Example Query**

```graphql
query GetProduct($id: ID!) {
    product(id: $id) {
        id,
        name,
        mdbId,
        type,
        active
    }
}

# Example variables
{
    "id": "<ID>"
}
```

**Query**
## productBackorders — Returns [ConnectionType](/documentation/General/Connections) of [ProductBackorder](/documentation/Objects/Products#ProductBackorder)

**Scopes required:** see_product_backorders

| Arguments | Type | Description |
| --- | --- | --- |
| outlet | [ID](/documentation/Types/UUID#UUID) | The ID of the Outlet to retrieve backorders for |
| products | [[ID!]](/documentation/Types/UUID#UUID) | The IDs of the products to retrieve backorders for |
| customers | [[ID!]](/documentation/Types/UUID#UUID) | The IDs of the customers to retrieve backorders for |
| dueBefore | [DateTime](/documentation/Types/Date-Time#DateTime) | Get the backorders that are due before this date (inclusive) |
| dueAfter | [DateTime](/documentation/Types/Date-Time#DateTime) | Get the backorders that are due after this date (inclusive) |

**Example Query**

```graphql
query GetProductBackorders($outlet: ID) {
    productBackorders(outlet: $outlet) {
        edges {
            node {
                id,
                quantity,
                recurringPeriod,
                nextDueDate,
                notes
            }
        },
        pageInfo {
            hasNextPage,
            endCursor
        }
    }
}

# Example variables
{
    "outlet": "<OUTLET>"
}
```

**Query**
## products — Returns [ConnectionType](/documentation/General/Connections) of [Product](/documentation/Objects/Products#Product)

**Scopes required:** see_products

### Sortable Fields
*Fields from [Product](/documentation/Objects/Products#Product) that can be used to sort the connection items*

- name
- createdAt
- updatedAt

| Arguments | Type | Description |
| --- | --- | --- |
| outletId | [ID](/documentation/Types/UUID#UUID) | The outlet ID to check if the product is stocked in, if empty all outlets will be checked |
| products | [[ID]](/documentation/Types/UUID#UUID) | A list of products to retrieve |
| brands | [[ID]](/documentation/Types/UUID#UUID) | A list of brands to filter the products by |
| categories | [[ID]](/documentation/Types/UUID#UUID) | A list of categories to filter the products by |
| families | [[ID]](/documentation/Types/UUID#UUID) | A list of families to filter the products by |
| tags | [[ID]](/documentation/Types/UUID#UUID) | A list of tags to filter the products by |
| supplier | [ProductSupplierCodeInput](/documentation/Inputs/Product-Supplier-Code-Input#ProductSupplierCodeInput) | A supplier (and codes) to filter the products by |
| mdbIds | *[Int]* | A list of master database reference to filter the products by (contact Shopfront if you wish to use this field) |
| stocked | *Boolean* | Whether to retrieve only products that are stocked |
| inventoryAbove | *Float* | Retrieve only products with inventory levels at any outlet greater than (exclusively) the provided value |
| inventoryBelow | *Float* | Retrieve only products with inventory levels at any outlet lower than (exclusively) the provided value |
| inventoryEqual | *Float* | Retrieve only products with inventory levels at any outlet equal to the provided value |
| inventoryLocation | [ProductInventoryLocationEnum](/documentation/Enums/Product-Inventory-Location-Enum#ProductInventoryLocationEnum) | How inventory levels should be filtered to match items |
| taxRates | [[ID]](/documentation/Types/UUID#UUID) | A list of tax rates to filter the products by |
| costTaxRates | [[ID]](/documentation/Types/UUID#UUID) | A list of cost tax rates to filter the products by |
| temporary | *Boolean* | Whether to show temporary products or not (null shows all, true shows only temporary and false shows not temporary), defaults to false |
| statuses | [[ProductStatusEnum]](/documentation/Enums/Product-Status-Enum#ProductStatusEnum) | The statuses of products you want returned (e.g. [ACTIVE] will only return the active products) |
| priceSets | [[ID]](/documentation/Types/UUID#UUID) | A list of price sets to filter the products by, any product which doesn't have a price set provided will be filtered out |
| barcodes | *[String!]* | A list of barcodes to filter the products by, these should be the exact barcodes |
| partialBarcodes | *[String!]* | A list of partial barcodes to filter the products by, any part of a barcode which matches one of these elements will be returned. NOTE: We would suggest matching using the `barcodes` field if possible as that is much quicker |
| hostDeletions | *Boolean* | Whether to retrieve products that have host deletions or not. When no value is supplied this filter is skipped "true" returns only products with host deletions, "false" returns products without host deletions |
| createdBefore | [DateTime](/documentation/Types/Date-Time#DateTime) | Filters products that have been created before or on the provided date time |
| createdAfter | [DateTime](/documentation/Types/Date-Time#DateTime) | Filters products that have been created after or on the provided date time |
| updatedBefore | [DateTime](/documentation/Types/Date-Time#DateTime) | Filters products that have been updated before or on the provided date time |
| updatedAfter | [DateTime](/documentation/Types/Date-Time#DateTime) | Filters products that have been updated after or on the provided date time |
| lastSoldBefore | [DateTime](/documentation/Types/Date-Time#DateTime) | Filters products that last appeared in a sale before or on the provided date, or have never been in a sale |
| lastSoldAfter | [DateTime](/documentation/Types/Date-Time#DateTime) | Filters products that last appeared in a sale after or on the provided date time |
| lastPurchasedBefore | [DateTime](/documentation/Types/Date-Time#DateTime) | Filters products that last appeared on an order before or on the provided date time, or have never been on an order |
| lastPurchasedAfter | [DateTime](/documentation/Types/Date-Time#DateTime) | Filters products that last appeared on an order after or on the provided date time |
| lastStocktakedBefore | [DateTime](/documentation/Types/Date-Time#DateTime) | Filters products last were stocktaked before or on the provided timestamp, including creating the product, updating the product's inventory, applying advanced stocktakes and express stocktaking |
| lastStocktakedAfter | [DateTime](/documentation/Types/Date-Time#DateTime) | Filters products last were stocktaked after or on the provided timestamp, including creating the product, updating the product's inventory, applying advanced stocktakes and express stocktaking |
| name | *String* | Filters product by their name |

**Example Query**

```graphql
query GetProducts($outletId: ID) {
    products(outletId: $outletId) {
        edges {
            node {
                id,
                name,
                mdbId,
                type,
                active
            }
        },
        pageInfo {
            hasNextPage,
            endCursor
        }
    }
}

# Example variables
{
    "outletId": "<OUTLET_ID>"
}
```

**Query**
## searchProducts — Returns [[Product]](/documentation/Objects/Products#Product)

**Scopes required:** see_products

> <p>This route is deprecated, do not use in any new development.</p>
> <p>This will be removed once an alternative has been added to the GetProducts route.</p>

| Arguments | Type | Description |
| --- | --- | --- |
| search | *String* | The name of the product to search for |

**Example Query**

```graphql
query SearchProducts($search: String) {
    searchProducts(search: $search) {
        id,
        name,
        mdbId,
        type,
        active
    }
}

# Example variables
{
    "search": "<SEARCH>"
}
```