Inventory

Overview of the Inventory resource and associated endpoints.

Inventory represents the stock holding that a specific seller has for a multi-store advert variant. For instance, a parent seller might have an advert with two variants: “Blue / Small” and “Red / Large”; Seller A might hold 2 of the “Blue / Small” variant while Seller B holds 3 of the “Red / Large” variant. This would be represented by 2 inventory items:

  • Seller A, “Blue / Small”, 2 on hand
  • Seller B, “Red / Large”, 3 on hand

You can retrieve the seller IDs related to the multi-store using multi_store_memberships.

An inventory item can have a different price/sale price from the parent variant. It can also be configured to have infinite stock which never sells out.

List a variant’s inventory items

Request

GET /api/v2/client/variants/1/inventories

Response

Status: 200 OK
{
  "data": [
    {
      "id": 1,
      "type": "inventories",
      "attributes": {
        "count_on_hand": 10,
        "price": "500",
        "sale_price": "450",
        "infinite": false,
        "seller_id": 1,
        "fulfilment_provider": "fulfilment_provider"
      }
    }
  ]
}

Updating a variant’s inventory

This route can be used by:

  • The multi-store parent to update or create multiple inventories
  • Members of the multi-store to update or create a single inventory record associated with their multi-store membership.

Request

PUT /api/v2/client/variants/1/inventories

Multi Store Owner / Parent Example

{
  "data": [
    {
      "type": "inventories",
      "attributes": {
        "count_on_hand": 10,
        "price": 500,
        "sale_price": 450,
        "seller_id": 1,
        "fulfilment_provider": "fulfilio"
      }
    },
    {
      "type": "inventories",
      "attributes": {
        "count_on_hand": 15,
        "seller_id": 2
      }
    },
    {
      "type": "inventories",
      "attributes": {
        "infinite": true,
        "seller_id": 3
      }
    }
  ]
}

Multi Store Owner / Parent Response

Status: 200 OK
{
  "data": [
    {
      "id": 1,
      "type": "inventories",
      "attributes": {
        "count_on_hand": 10,
        "price": "500",
        "sale_price": "450",
        "infinite": false,
        "seller_id": 1,
        "fulfilment_provider": "fulfilment_provider"
      }
    },
    {
      "id": 2,
      "type": "inventories",
      "attributes": {
        "count_on_hand": 15,
        "price": null,
        "sale_price": null,
        "infinite": false,
        "seller_id": 2,
        "fulfilment_provider": ""
      }
    },
    {
      "id": 3,
      "type": "inventories",
      "attributes": {
        "infinite": true,
        "seller_id": 3,
        "fulfilment_provider": ""
      }
    }
  ]
}

Multi Store Member / Child Example

{
  "data": [
    {
      "attributes": {
        "count_on_hand": 22,
        "price": 27.38,
        "sale_price": 21.99,
        "infinite": false,
        "fulfilment_provider": "fulfilment_provider"
      }
    }
  ]
}

Multi Store Member / Child Response

Status: 200 OK
{
  "data": [
    {
      "id": 1,
      "type": "inventories",
      "attributes": {
        "count_on_hand": 22,
        "price": "27.38",
        "sale_price": "21.99",
        "infinite": false,
        "seller_id": 1,
        "fulfilment_provider": "fulfilment_provider"
      }
    },
    {
      "id": 2,
      "type": "inventories",
      "attributes": {
        "count_on_hand": 15,
        "price": null,
        "sale_price": null,
        "infinite": false,
        "seller_id": 2,
        "fulfilment_provider": ""
      }
    },
    {
      "id": 3,
      "type": "inventories",
      "attributes": {
        "infinite": true,
        "seller_id": 3,
        "fulfilment_provider": ""
      }
    }
  ]
}

Deleting an inventory record

Request

DELETE /api/v2/client/variants/1/inventories/1

Reponse

Status: 204 No Content