From f24429caef6d1228d82f8f93c9df5ba4124f776b Mon Sep 17 00:00:00 2001 From: seb Date: Thu, 3 Jul 2025 06:35:51 +0200 Subject: [PATCH] Implement product price validation in generateProductsXml to skip products with a price of zero, improving data integrity in XML generation. --- prerender/seo.cjs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/prerender/seo.cjs b/prerender/seo.cjs index 111e27d..27aa29b 100644 --- a/prerender/seo.cjs +++ b/prerender/seo.cjs @@ -648,6 +648,12 @@ const generateProductsXml = (allProductsData = [], baseUrl, config) => { ? `${parseFloat(product.price).toFixed(2)} ${config.currency}` : `0.00 ${config.currency}`; + // Skip products with price == 0 + if (!product.price || parseFloat(product.price) === 0) { + skippedCount++; + return; + } + // Generate GTIN/EAN if available (using articleNumber as fallback) const rawGtin = product.gtin || ""; const gtin = escapeXml(rawGtin.toString().trim());