Gets the availability of relevant product variants based on the product ID and selections provided. See Use Cases for an example.
function getProductOptionsAvailability(
_id: string,
options: Record<string, string>,
): Promise<ProductOptionsAvailabilityResponse>;
Requested product ID.
Array containing the selected options. For example, ["color": "Blue", "size": "Large"]
.
import { products } from "wix-stores.v2";
async function getProductOptionsAvailability(id, options) {
try {
const result = await products.getProductOptionsAvailability(id, options);
return result;
} catch (error) {
console.error(error);
// Handle the error
}
}
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.