The Shopify product handle
Object containing product data, loading state, and error state
import { useShopifyProduct } from '@nosto/search-js/preact/hooks'
export default function ProductPage() {
const { product, loading, error } = useShopifyProduct("my-product-handle")
if (loading) return <div>Loading...</div>
if (error) return <div>Error: {error}</div>
if (!product) return <div>Product not found</div>
return (
<div>
<h1>{product.title}</h1>
<p>{product.description}</p>
<p>Price: ${product.price / 100}</p>
</div>
)
}
Preact hook that fetches and exposes product data from Shopify's handle.js endpoint.