diff --git a/components/cart-item.js b/components/cart-item.js index 140792a..f2a3545 100644 --- a/components/cart-item.js +++ b/components/cart-item.js @@ -1,11 +1,8 @@ -import React from 'react' import Link from 'next/link' -import { hasObject } from '@lib/helpers' -import { useUpdateItem, useRemoveItem, useToggleCart } from '@lib/context' +import { useRemoveItem, useToggleCart, useUpdateItem } from '@lib/context' -import Photo from '@components/photo' import { ProductCounter, ProductPrice } from '@components/product' function CartItem({ item }) { @@ -14,24 +11,28 @@ function CartItem({ item }) { const toggleCart = useToggleCart() const changeQuantity = (quantity) => { - updateItem(item.lineID, quantity) + updateItem(item.id, quantity) } - const defaultPhoto = item.photos.cart?.find((set) => !set.forOption) - const variantPhoto = item.photos.cart?.find((set) => { - const option = set.forOption - ? { - name: set.forOption.split(':')[0], - value: set.forOption.split(':')[1], - } - : {} - return option.value && hasObject(item.options, option) - }) + /* + const defaultPhoto = item.photos.cart?.find((set) => !set.forOption); + const variantPhoto = item.photos.cart?.find((set) => { + const option = set.forOption + ? { + name: set.forOption.split(':')[0], + value: set.forOption.split(':')[1], + } + : {}; + return option.value && hasObject(item.options, option); + }); - const photos = variantPhoto ? variantPhoto : defaultPhoto + const photos = variantPhoto ? variantPhoto : defaultPhoto; + */ + const photos = item.merchandise.product.images.edges[0].node.originalSrc return (