x
This commit is contained in:
1 parent
5fac4524c8
commit
e1d793ce37
69 files changed
+1892
-610
No files matched your search
@@ -99,7 +99,7 @@ export default function AddToCartSection({ product }: Props) {
|
||||
productId: product.id,
|
||||
variantId: currentVariant.id,
|
||||
quantity: 1,
|
||||
price: currentVariant.price || product.price || 0,
|
||||
price: currentVariant.price || 0,
|
||||
productName,
|
||||
variantName: variantName || undefined,
|
||||
productImage: product.images?.[0]?.url || product.category.imageUrl || getCategoryImage(categoryName),
|
||||
@@ -133,7 +133,7 @@ export default function AddToCartSection({ product }: Props) {
|
||||
|
||||
<div className="flex items-baseline gap-3">
|
||||
<span className="text-4xl font-bold text-brand-primary">
|
||||
{formatPrice(currentVariant?.price ?? product.price)}
|
||||
{formatPrice(currentVariant?.price ?? 0)}
|
||||
</span>
|
||||
{currentVariantName && <span className="text-sm text-muted-text">/ {currentVariantName}</span>}
|
||||
</div>
|
||||
@@ -215,7 +215,7 @@ export default function AddToCartSection({ product }: Props) {
|
||||
<span className="text-[10px] font-bold uppercase tracking-widest text-muted-text/70">
|
||||
{currentVariantName || 'Total Price'}
|
||||
</span>
|
||||
<span className="text-xl font-bold text-brand-primary">{formatPrice(currentVariant?.price ?? product.price)}</span>
|
||||
<span className="text-xl font-bold text-brand-primary">{formatPrice(currentVariant?.price ?? 0)}</span>
|
||||
</div>
|
||||
<button
|
||||
onClick={handleAddToCart}
|
||||
|
||||
@@ -23,7 +23,7 @@ export default function ProductCard({ product }: ProductCardProps) {
|
||||
const categoryName = resolveCategoryName(product.category, lang)
|
||||
const productName = resolveLocalized(product.name, lang) || product.brand.name
|
||||
const imageUrl = product.images?.[0]?.url || product.category.imageUrl || getCategoryImage(categoryName)
|
||||
const displayPrice = selectedVariant?.price ?? product.variants[0]?.price ?? product.price
|
||||
const displayPrice = selectedVariant?.price ?? product.variants[0]?.price ?? 0
|
||||
|
||||
const addToCartLabels: Record<string, string> = {
|
||||
th: 'เพิ่มลงตะกร้า',
|
||||
@@ -100,7 +100,7 @@ export default function ProductCard({ product }: ProductCardProps) {
|
||||
<div className="mt-auto flex flex-col gap-2 pt-3">
|
||||
<div className="flex items-center justify-between">
|
||||
<span className="text-sm font-black text-brand-primary md:text-lg">
|
||||
{formatPrice(selectedVariant?.price ?? product.variants?.[0]?.price ?? product.price)}
|
||||
{formatPrice(selectedVariant?.price ?? product.variants?.[0]?.price ?? 0)}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -125,7 +125,7 @@ export default function ProductCard({ product }: ProductCardProps) {
|
||||
productId: product.id,
|
||||
variantId: targetVariant.id,
|
||||
quantity: 1,
|
||||
price: targetVariant.price || product.price || 0,
|
||||
price: targetVariant.price || 0,
|
||||
productName: productName,
|
||||
variantName: [targetVariant.option1, targetVariant.option2, targetVariant.option3].filter(Boolean).join(' / '),
|
||||
productImage: imageUrl
|
||||
|
||||
Reference in new issue
Block a user