Check whether a set of products can be built and bought right now
Given a list of product page urls, reads each one's price and stock the way `products.getAvailability` does, then reduces the set to one…
Given a list of product page urls, reads each one's price and stock the way products.getAvailability does, then reduces the set to one buildable/not-buildable verdict naming whatever is blocking it.
Also known as: product bundle, product bundle builder, bundle, bundle availability, configurator, build a bundle, build a product bundle, can this be built, multi-item availability, kit availability
Call it
bowmark.bundles.checkAvailability(items: { url: string }[]): Promise<BundleAvailability>Functions
| Function | What it does |
|---|---|
checkAvailability | Reads every item's product page and returns whether the WHOLE bundle can be built and bought right now — false the moment any one item is out of stock, pre-order, or unreadable, naming… |
Types
interface BundleItemAvailability {
url: string
ok: boolean
buildable: boolean
price: { amount: number; currency: string } | null // integer minor units
availability: string | null
reason: string | null
}
interface BundleAvailability {
buildable: boolean
items: BundleItemAvailability[]
blocking: string[] // urls of the items stopping the bundle
totalPrice: { amount: number; currency: string } | null
warnings: string[]
}Examples
// Two real, live product pages — run this as-is to see a genuine bundle read
// when the caller hasn't named a specific set of items yet.
const bundle = await bowmark.bundles.checkAvailability([
{ url: "https://www.nativecos.com/products/last-chance-plastic-free-deodorant-stick" },
{ url: "https://www.nativecos.com/products/coconut-vanilla-deodorant" },
]);
log(bundle.buildable ? "buildable now" : `blocked on: ${bundle.blocking.join(", ")}`);
return { buildable: bundle.buildable, totalPrice: bundle.totalPrice, blocking: bundle.blocking };Providers behind it
None — this capability needs no site. It computes the answer, or reads a public API that publishes it.