Skip to main content

fetchProductData

fetchProductData fetches product data from Shopify's AJAX API by product handle. Under the hood it calls fetchJSON against /products/{handle}.js and returns a Promise that resolves with the product object (variants, images, price, etc.).

This is the quickest way to pull down full product data client-side — for example to hydrate a quick-view modal or update a product card after a variant change.

Usage examples

Basic

const product = await window.BAO.utils.fetchProductData('classic-t-shirt')

console.log(product.title) // 'Classic T-Shirt'
console.log(product.variants) // [{ id, title, price, ... }, ...]