> 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

# Method name: getOptionsAvailability(productId: string, choices: object)

# Method package: wixStoresFrontend

# Method menu location: wixStoresFrontend --> Product --> getOptionsAvailability

# Method Link: https://dev.wix.com/docs/velo/apis/wix-stores-frontend/product/get-options-availability.md

# Method Description:

Retrieves the availability of a product based on the specified option choices.

The information returned in the `selectedVariant` and `availableForPurchase`
 properties reflects the option choices passed in the `choices` parameter.

 If the specified choices result in the selection of a single product variant,
 that variant is returned in the `selectedVariant` property and the `availableForPurchase`
 property indicates whether that product variant is available for purchase.

 If the choices specified in the `choices` parameter don't result in the selection of a single product variant,
 no variant is returned in the `selectedVariant` property and the `availableForPurchase`
 property will be `false`.



# Method Code Examples:

*** Note: do not assume any prop names or enum values other than the ones in the example.

## Get a product's availability information

```javascript
import { product } from 'wix-stores-frontend';

const productId = "91f7ac8b-2baa-289c-aa50-6d64764f35d3";
const choices = {
  "Weight": "250g",
  "Ground for": "Stovetop"
};

product.getOptionsAvailability(productId, choices)
  .then((availability) => {
    const available = availability.availableForPurchase;
    const options = availability.productOptions;
    const mainMedia = availability.mainMedia;
    const mediaItems = availability.mediaItems;
    const selectedVariant = availability.selectedVariant;
  })
  .catch((error) => {
    console.log(error);
  });


/*
 * Example of returned availability object:
 *
 *  {
 *    "availableForPurchase": true,
 *    "productOptions": {
 *      "Weight": {
 *        "optionType": "drop_down",
 *        "name": "Weight",
 *        "choices": [
 *          {
 *            "value": "250g",
 *            "description": "250g",
 *            "inStock": true,
 *            "visible": true,
 *            "mainMedia": "null",
 *            "mediaItems": []
 *          },
 *          {
 *            "value": "500g",
 *            "description": "500g",
 *            "inStock": true,
 *            "visible": true,
 *            "mainMedia": "null",
 *            "mediaItems": []
 *          }
 *        ]
 *      },
 *      "Ground for": {
 *        "optionType": "drop_down",
 *        "name": "Ground for",
 *        "choices": [
 *          {
 *            "value": "Stovetop",
 *            "description": "Stovetop",
 *            "inStock": true,
 *            "visible": true,
 *            "mainMedia": "null",
 *            "mediaItems": []
 *          },
 *          {
 *            "value": "Filter",
 *            "description": "Filter",
 *            "inStock": true,
 *            "visible": true,
 *            "mainMedia": "null",
 *            "mediaItems": []
 *          }
 *        ]
 *      }
 *    },
 *    "mainMedia": "null",
 *    "mediaItems": [],
 *    "selectedVariant": {
 *      "sku": "10001",
 *      "currency": "USD",
 *      "price": 35,
 *      "discountedPrice": 30,
 *      "formattedPrice": "$35.00",
 *      "formattedDiscountedPrice": "$30.00",
 *      "visible": true,
 *      "inStock": true,
 *      "weight": 0.25
 *    }
 *  }
 *
 */
```

---