fix(storefront): accurately reflect out-of-stock products based on stock quantity and stockStatus
Deploy Canina / deploy (push) Failing after 2m7s
E2E Playwright Tests / Run Full E2E & Security Suites (push) Failing after 10s

This commit is contained in:
devops committed 2026-10-14 15:10:59 +00:00
1 parent 6c53126cb6
commit 075f00a4ed
5 files changed
+22 -7

No files matched your search

@@ -1,6 +1,6 @@
"use client";
import React, { useState, useMemo, useEffect, useCallback } from "react";
import { toPersian } from "../lib/utils";
import { toPersian, isProductOutOfStock } from "../lib/utils";
import { Product, PetType } from "../lib/data/products";
import { usePetStore } from "../lib/store/usePetStore";
import { productService } from "../lib/services/productService";
@@ -205,7 +205,7 @@ export const ArchiveProductCard: React.FC<{ product: Product }> = ({ product })
</div>
<div className="shrink-0 mr-auto">
{(product.packageSize !== undefined && product.packageSize !== null ? Number(product.packageSize) : 100) <= 0 ? (
{isProductOutOfStock(product) ? (
<span className="px-2.5 py-1.5 rounded-xl bg-rose-50 text-rose-600 border border-rose-100 text-xs font-bold font-vazir whitespace-nowrap inline-block">
ناموجود
</span>
@@ -294,7 +294,7 @@ const ArchiveProductListItem: React.FC<{ product: Product }> = ({ product }) =>
return null;
}, [product, activePet]);
const isOutOfStock = (product.packageSize !== undefined && product.packageSize !== null ? Number(product.packageSize) : 100) <= 0;
const isOutOfStock = isProductOutOfStock(product);
const { showPrices, allowCart, showPreorderBtn } = useCatalogMode();
return (