> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

## Resource: Sample Use Cases and Flows

## Article: Sample Use Cases and Flows

## Article Link: https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/inventory-items-v3/sample-use-cases-and-flows.md

## Article Content:

# Inventory Items API: Sample Flows

This article presents possible use cases and corresponding sample flows that you can support. This can be a helpful jumping off point as you plan your implementation.

## Create inventory for a new product in the default location

After adding a new product to your catalog using the [Create Product](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/products-v3/create-product.md) endpoint, you need to set up inventory tracking. This is a common scenario when expanding your product catalog and preparing items for sale.

> **Note:** Alternatively, you can use [Create Product With Inventory](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/products-v3/create-product-with-inventory.md) to create both the product and its inventory items in a single call.

> **Note:** When customers place orders on a Wix Store, inventory automatically deducts from the default location. If you need to deduct stock from specific non-default locations, you can't use Wix's standard checkout functionality. For more details, see [Online Store Product Purchase Flow](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/online-store-product-purchase-flow.md).

To create inventory for a new product in the default location:

1. Create a new product by calling [Create Product](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/products-v3/create-product.md). Note the returned `productId` and `variantId`(s) from the response.
2. Call [Create Inventory Item](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/inventory-items-v3/create-inventory-item.md) for each variant. Provide the `productId` and `variantId`, along with the initial quantity or tracking method. When you don't specify a `locationId`, the inventory item is created in the default location.

## Create inventory items in a specific location

You want to add a new inventory item to a specific location in your Wix store. This is useful when you have new stock arriving at a particular warehouse or store location and need to update your inventory system accordingly.

To create an inventory item in a specific location:

1. Call [Query Stores Locations](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/stores-locations-v3/query-stores-locations.md) to identify the location where you want to update your stock.
2. Call [Create Inventory Item](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/inventory-items-v3/create-inventory-item.md) and provide the necessary details such as `variantId`, `productId`, and any other relevant information. Specify the location by including the `locationId` in your request.

## Increment inventory of a variant

When you receive additional stock for a specific variant of a product, or when a customer wants to return or refund an item, you need to update the inventory quantity in your system. This ensures that your stock levels are accurate and customers can see the correct availability.

To increment the inventory of a variant:

1. Identify the variant of the product whose inventory you want to increment. You need the `variantId` for this step.
2. Call [Bulk Increment Inventory Items By Variant And Location](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/inventory-items-v3/bulk-increment-inventory-items-by-variant-and-location.md) and include the `IncrementData.variantId` and `IncrementData.locationId` to update the inventory quantity for the specified variant in a specific location.

## Find items that are low on stock

You want to list inventory items whose quantity has dropped to or below a threshold, so you can restock them.

To find low-stock inventory items:

1. Call [Query Inventory Items](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/inventory-items-v3/query-inventory-items.md) and filter by `quantity` with `$lte` and your threshold. Optionally add `locationId` to limit results to a specific location.

   ```json
   {
     "query": {
       "filter": {
         "quantity": {"$lte": 5}
       }
     }
   }
   ```

   The results include out-of-stock items, whose quantity is `0`. To exclude them, combine 2 conditions with `$and`:

   ```json
   {
     "query": {
       "filter": {
         "$and": [
           {"quantity": {"$gt": 0}},
           {"quantity": {"$lte": 5}}
         ]
       }
     }
   }
   ```

   > **Note:** Quantities are only tracked for inventory items with `trackQuantity` set to `true`.
2. To restock the items you found, call [Bulk Increment Inventory Items](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/inventory-items-v3/bulk-increment-inventory-items.md) and specify `incrementData` as an array of `{ "inventoryItemId": "...", "incrementBy": 10 }` objects.

## Change the tracking method for a product

You want to change the inventory tracking method for a specific product to "In Stock". This is useful when you don't manage stock levels for products that are not physically stored or have continuous inventory.

To change the inventory items tracking method to "In Stock" for a specific product:

1. Call [Bulk Update Inventory Items By Filter](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/inventory-items-v3/bulk-update-inventory-items-by-filter.md) to update the inventory item.
2. In the request body, set the `inventoryItem.inStock` field to `true`.
3. Include a `filter` with the product ID, for example: `{"productId": "f54bc047-ea9d-4910-afa0-a9bea33af481"}`.

## Find in-stock products at a specific location

You want to retrieve a list of all products that are currently in stock at a specific location. This is useful for managing inventory, ensuring stock levels are adequate, and making informed business decisions.

To find in-stock products at a specific location:

1. Call [Query Stores Locations](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/stores-locations-v3/query-stores-locations.md) to identify the location for which you want to check the stock. This ID is necessary to filter the inventory items by location.
2. Call [Search Inventory Items](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/inventory-items-v3/search-inventory-items.md) and include `locationId` and `availabilityStatus` in the `filter` parameter of your request to retrieve inventory items based on their availability status at a specific location:

```json
{
  "search": {
    "filter": {
      "$and": [
        {"locationId": "2441a0f8-9e40-4fff-8740-52a7623b0dbd"},
        {"availabilityStatus": "IN_STOCK"}
      ]
    }
  }
}
```

3. To get more information about the products, call [Search Products](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/products-v3/search-products.md) and include the list of product IDs retrieved from the previous call in the filter:

```json
{
  "search": {
    "filter": {
      "id": {
        "$in": [
          "b46df258-3242-4f52-8bcd-dad536d45ef4",
          "f117c5f0-7130-465a-8356-680cd2b80c74"
        ]
      }
    }
  }
}
```