Get Product by Slug
Fetch a single product with full details and variations.
Updated
Fetch a single product with full details and variations.
Updated
For faster page loads, split the request into a lightweight server fetch and a heavier client fetch:
// Server component — fast initial render
const { product } = await dash.products.getCore("blue-dream")
// Returns: name, price, images, description (no variations/sizes)
// Client component — load interactive data
const { options } = await dash.products.getOptions("blue-dream")
// Returns: variations, sizes, bulk discounts
This pattern lets you render the page shell on the server while loading the variation picker on the client. See Data Fetching for more on this pattern.
{
"id": "prod_abc123",
"name": "Blue Dream",
"slug": "blue-dream",
"description": "<p>Premium quality...</p>",
"main_image": "https://cdn.dashfordevs.com/...",
"price": "29.99",
"discounted_price": "24.99",
"in_stock": true,
"avg_rating": 4.7,
"reviews_count": 42,
"images": [
{ "id": "img_1", "image": "https://...", "alt_text": "Front view", "order": 0 }
],
"attributes": [
{
"id": "attr_strain",
"name": "Strain",
"options": [
{
"id": "opt_bd",
"value": "Blue Dream",
"slug": "blue-dream",
"description": "Sativa-dominant hybrid",
"main": true,
"image": "https://...",
"sizes": [
{
"id": "size_1g",
"label": "1g",
"price": "29.99",
"discounted_price": "24.99",
"stock": 50,
"in_stock": true,
"bulk_discounts": [
{ "min_quantity": 5, "discount_type": "percentage", "discount_value": "10" }
]
}
]
}
]
}
],
"features": ["Lab tested", "Organic"],
"qna": [{ "question": "Is this organic?", "answer": "Yes." }],
"related": [{ "id": "prod_def", "name": "OG Kush", "slug": "og-kush", "price": "34.99" }],
"category": { "id": "cat_xyz", "name": "Flower", "slug": "flower" },
"custom_fields": {}
}
GET /storefront/products/blue-dream
X-API-Key: pk_live_your_key
// app/products/[slug]/page.tsx
import dash from "@/lib/dash"
export default async function ProductPage({ params }) {
const { product } = await dash.products.getCore(params.slug)
return (
<div>
<img src={product.main_image} alt={product.name} />
<h1>{product.name}</h1>
<p>${product.discounted_price || product.price}</p>
<div dangerouslySetInnerHTML={{ __html: product.description }} />
<VariationPicker slug={params.slug} />
</div>
)
}