www/apps/resources/references/utils/utils.ProductUtils/page.mdx
import { TypeList } from "docs-ui"
Computes the total availability for a list of variants across all stock locations
<TypeList types={[{"name":"query","type":"Omit<RemoteQueryFunction, symbol>","description":"The Query function","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"graph","type":"QueryGraphFunction","description":"Graph function uses the remoteQuery under the hood and\nreturns a result set","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"index","type":"QueryIndexFunction","description":"Index function uses the index module to query and remoteQuery to hydrate the data\nreturns a result set","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"gql","type":"(query: string, variables?: Record<string, unknown>, options?: RemoteJoinerOptions) => Promise<any>","description":"Query wrapper to provide specific GraphQL like API around remoteQuery.query","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"data","type":"TotalVariantAvailabilityData","description":"An object containing the variant ids to compute the availability for","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"variant_ids","type":"string[]","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="getTotalVariantAvailability"/>
<TypeList types={[{"name":"Promise","type":"Promise<object>","optional":false,"defaultValue":"","description":"the total availability for the given variants","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="getTotalVariantAvailability"/>
Computes the variant availability for a list of variants in a given sales channel
The availability algorithm works as follows:
The algorithm takes into account:
<TypeList types={[{"name":"query","type":"Omit<RemoteQueryFunction, symbol>","description":"The Query function","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"graph","type":"QueryGraphFunction","description":"Graph function uses the remoteQuery under the hood and\nreturns a result set","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"index","type":"QueryIndexFunction","description":"Index function uses the index module to query and remoteQuery to hydrate the data\nreturns a result set","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"gql","type":"(query: string, variables?: Record<string, unknown>, options?: RemoteJoinerOptions) => Promise<any>","description":"Query wrapper to provide specific GraphQL like API around remoteQuery.query","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"data","type":"VariantAvailabilityData","description":"An object containing the variant ids and the sales channel id to compute the availability for","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"variant_ids","type":"string[]","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"sales_channel_id","type":"string","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="getVariantAvailability"/>
<TypeList types={[{"name":"Promise","type":"Promise<VariantAvailabilityResult>","optional":false,"defaultValue":"","description":"an object containing the variant ids and their availability","expandable":false,"children":[{"name":"VariantAvailabilityResult","type":"object","description":"The computed inventory availability for variants in a given sales channel.\nThe object's keys are the variant IDs.","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/learn/fundamentals/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="getVariantAvailability"/>
Const ProductEvents: ReturnType<["product", "productVariant", "productOption", "productOptionValue", "productType", "productTag", "productCategory", "productCollection", "productImage"], "product">