diff --git a/lib/fourthwall/index.ts b/lib/fourthwall/index.ts index 1635f35ba..a3fb7c6d2 100644 --- a/lib/fourthwall/index.ts +++ b/lib/fourthwall/index.ts @@ -97,15 +97,13 @@ export async function getCollectionProducts({ */ export async function getProduct({ handle, currency } : { handle: string, currency: string }): Promise { // TODO: replace with real URL - const res = await fourthwallGet<{results: FourthwallProduct[]}>(`${API_URL}/api/public/v1.0/collections/${process.env.FW_COLLECTION}/products?secret=${API_SECRET}¤cy=${currency}`, { + const res = await fourthwallGet(`${API_URL}/api/public/v1.0/products/${handle}?secret=${API_SECRET}¤cy=${currency}`, { headers: { 'X-ShopId': process.env.FW_SHOPID || '' } }); - return res.body.results.filter((product) => { - return product.slug === handle - }).map((p: any) => reshapeProduct(p))[0]; + return reshapeProduct(res.body); } export async function getProductRecommendations(productId: string): Promise {