mirror of
https://github.com/vercel/commerce.git
synced 2025-07-23 04:36:49 +00:00
Add Reaction Commerce provider
Signed-off-by: Loan Laux <loan@outgrow.io>
This commit is contained in:
@@ -34,7 +34,7 @@ const ProductCard: FC<Props> = ({
|
||||
{product?.images && (
|
||||
<Image
|
||||
quality="85"
|
||||
src={product.images[0].url || placeholderImg}
|
||||
src={product.images[0]?.url || placeholderImg}
|
||||
alt={product.name || 'Product Image'}
|
||||
height={320}
|
||||
width={320}
|
||||
@@ -70,7 +70,7 @@ const ProductCard: FC<Props> = ({
|
||||
<Image
|
||||
alt={product.name || 'Product Image'}
|
||||
className={s.productImage}
|
||||
src={product.images[0].url || placeholderImg}
|
||||
src={product.images[0]?.url || placeholderImg}
|
||||
height={540}
|
||||
width={540}
|
||||
quality="85"
|
||||
|
@@ -30,7 +30,6 @@ const ProductView: FC<Props> = ({ product }) => {
|
||||
const { openSidebar } = useUI()
|
||||
const [loading, setLoading] = useState(false)
|
||||
const [choices, setChoices] = useState<SelectedOptions>({
|
||||
size: null,
|
||||
color: null,
|
||||
})
|
||||
|
||||
@@ -40,9 +39,17 @@ const ProductView: FC<Props> = ({ product }) => {
|
||||
const addToCart = async () => {
|
||||
setLoading(true)
|
||||
try {
|
||||
const selectedVariant = variant ? variant : product.variants[0]
|
||||
|
||||
console.log('selected variant', selectedVariant)
|
||||
|
||||
await addItem({
|
||||
productId: String(product.id),
|
||||
variantId: String(variant ? variant.id : product.variants[0].id),
|
||||
variantId: String(selectedVariant.id),
|
||||
pricing: {
|
||||
amount: selectedVariant.price,
|
||||
currencyCode: product.price.currencyCode,
|
||||
},
|
||||
})
|
||||
openSidebar()
|
||||
setLoading(false)
|
||||
|
Reference in New Issue
Block a user