> ## Documentation Index
> Fetch the complete documentation index at: https://docs.supercycle.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Availability filter

> Let customers hide the sizes they can't rent or buy, across Supercycle and Shopify products

> [!NOTE]
>
> There are a few ways to build an availability filter. This guide shows one approach, and your theme developer can adapt it to suit your store.

An availability filter lets customers hide the sizes they can't rent or buy. It works with your other filters, so a customer who selects Small and Available sees only products with a Small available.

Supercycle sets the filter for the products you offer through Supercycle. Two Shopify Flow workflows set it for products you sell without Supercycle.

On a calendar method, a size counts as available when it can be booked for a later date, even if it's with a customer today. To let customers find what's free on their dates, set up [availability search](https://docs.supercycle.com/documentation/online-store/search.md).

***

## Create the Available metafield

**1. Open unstructured metafields**

On  [Metafields and metaobjects](https://admin.shopify.com/settings/custom_data), select **Variants**, then **View unstructured metafields**.

**2. Add the definition**

Find `supercycle.future_availability_inventory` and select **Add definition**.

**3. Name the metafield**

Enter `Available` in **Name** and set **Type** to **True or false**. Select **Save**, then **Save definition**.

**4. Ask support to refresh your products**

Once the definition is saved, contact support from the app and ask us to refresh your Supercycle products. Until we do, the filter doesn't match them.

***

## Add the filter in Search & Discovery

The filter runs on Shopify's free [Search & Discovery](https://apps.shopify.com/search-and-discovery) app.

**1. Open Filters**

In the Search & Discovery app, go to **Filters** and select **Add filter**.

**2. Set the source**

Select **Select source**, then **Available**, the one listed as a variant metafield.

**3. Label the filter**

Enter `Availability` in **Filter label** and select **Save**.

**4. Remove Shopify's Availability filter**

If your filters include Shopify's own **Availability** filter, open it and select **Remove**. It only reads Shopify stock, so it doesn't know which Supercycle sizes are available.

Customers see the filter with two options, Yes and No. To show a single Available option instead, ask your theme developer to add the [availability filter snippet](https://docs.supercycle.com/developers/code-snippets/availability-filter.md).

If you use [availability search](https://docs.supercycle.com/documentation/online-store/search.md), the Methods filter block applies this filter when a customer selects the calendar option.

***

## Set the filter on other products with Shopify Flow

Products you sell without Supercycle need the same metafield, set from their Shopify stock. Create two workflows in  [Flow](https://admin.shopify.com/apps/flow).

The first updates a product whenever its stock changes.

**1. Add the trigger**

Select **Create workflow**, then **Select a trigger**, and select **Product variant inventory quantity changed**.

**2. Skip Supercycle products**

Add a **Condition**. Select **Add a variable**, then **product**, then **tags**. Change **At least one of product / tags** to **None of product / tags** and enter `Supercycle product` as the value.

**3. Set the metafield**

On the True branch, add the **Update product variant metafield** action and select **Available** as the metafield. Under **Value**, select **Add variable**, then **productVariant**, then **availableForSale**. The value reads:

```liquid theme={null}
{{ productVariant.availableForSale }}
```

**4. Turn it on**

Select **Turn on workflow**, then **Turn on**.

The first workflow doesn't run when a product is created, or on a product whose stock hasn't changed since you turned it on. Until it runs, the filter hides that product, even when it's in stock. The second workflow covers both: it runs when a product is created, and you run it once on the products you already have. It also sets products that don't track stock, such as gift cards.

**1. Add the trigger**

Create a workflow with the **Product created** trigger.

**2. Skip Supercycle products**

Add a **Condition**. Select **Add a variable**, then **product**, then **tags**. Change **At least one of product / tags** to **None of product / tags** and enter `Supercycle product` as the value.

**3. Loop over the variants**

On the True branch, add the **For each loop (iterate)** action. Select **Add a variable**, then **product**, then **variants**.

**4. Set the metafield**

On the Repeat for each item branch, add the **Update product variant metafield** action and select **Available** as the metafield. Under **Value**, select **Add variable**, then **variantsForeachitem**, then **availableForSale**. The value reads:

```liquid theme={null}
{{ variantsForeachitem.availableForSale }}
```

**5. Turn it on**

Select **Turn on workflow**, then **Turn on**.

**6. Run it on your existing products**

On  [Products](https://admin.shopify.com/products), select the products you sell without Supercycle, up to 50 at a time. Select the **...** button, then **Run Flow automation**, select the workflow, and select **Run workflow**.

If you turn **Continue selling when out of stock** or **Track quantity** on or off without changing the stock, run the workflow on that product again.

***

## Let customers join the waitlist

The filter hides the sizes customers can't rent or buy. A customer who still opens a sold-out Supercycle product can join the [waitlist](https://docs.supercycle.com/documentation/manage/inventory/waitlist.md), so they're emailed when it's back in stock. The waitlist is in beta, and it works only on products you offer through Supercycle.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.