From 22b17e3a57fbfaf7fd196687d5f1dadab0ec812f Mon Sep 17 00:00:00 2001 From: Vitor Date: Mon, 27 Jul 2026 18:26:13 -0300 Subject: [PATCH 1/2] fix(storefront): Show cash discount price in product JSON-LD Product JSON-LD offers now apply the store's configured payment discount (settings.modules.list_payments.discount_option), reusing getPriceWithDiscount from use-prices. Falls back to the regular price when no discount is configured, so behavior is unchanged for stores that don't set it. --- packages/storefront/src/lib/layouts/BaseHead.astro | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/storefront/src/lib/layouts/BaseHead.astro b/packages/storefront/src/lib/layouts/BaseHead.astro index e404500c9..2a5ee9c70 100644 --- a/packages/storefront/src/lib/layouts/BaseHead.astro +++ b/packages/storefront/src/lib/layouts/BaseHead.astro @@ -8,6 +8,7 @@ import { inStock as checkInStock, } from '@ecomplus/utils'; import { i19searchProducts } from '@@i18n'; +import { getPriceWithDiscount } from '@@sf/composables/use-prices'; // @ts-ignore const isPWA = pwaInfo !== false; // config/astro/mock-pwa-info.mjs @@ -211,7 +212,10 @@ if (apiContext.resource === 'products' && apiContext.doc) { url: canonicalUrl, availability: `${(checkInStock(product) ? 'In' : 'OutOf')}Stock`, priceCurrency: settings.currency, - price: getPrice(product), + price: getPriceWithDiscount( + getPrice(product), + settings.modules?.list_payments?.discount_option || {}, + ), itemCondition: 'http://schema.org/' + `${(product.condition !== 'new' ? 'Used' : 'New')}Condition`, seller: { From 335d6ede42bb8e2e6c8a245bd1c4da4fceaada3d Mon Sep 17 00:00:00 2001 From: Leonardo Matos Date: Tue, 28 Jul 2026 04:43:37 -0300 Subject: [PATCH 2/2] fix(storefront): Round cash discount price in product structured data Applying a percentage discount to the price produces floating point noise and 3+ decimal places, which were serialized raw into the product JSON-LD (e.g. 89.90 -12% emitted 79.11200000000001, and 129.90 -5% emitted 123.405). Rounds to 2 decimals at the JSON-LD call site, matching the existing catalog feed behaviour in packages/feeds (render-catalog.ts uses toFixed(2) on the same calculation). Kept local to BaseHead so the shared getPriceWithDiscount used by cart/checkout is untouched. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01Y7qSxBB2tGRCvHa6h8tNRS --- packages/storefront/src/lib/layouts/BaseHead.astro | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/storefront/src/lib/layouts/BaseHead.astro b/packages/storefront/src/lib/layouts/BaseHead.astro index 2a5ee9c70..78fd90856 100644 --- a/packages/storefront/src/lib/layouts/BaseHead.astro +++ b/packages/storefront/src/lib/layouts/BaseHead.astro @@ -201,6 +201,10 @@ const inlineJSONLdWebsite = JSON.stringify({ let inlineJSONLdOffer: string | undefined; if (apiContext.resource === 'products' && apiContext.doc) { const product = apiContext.doc; + const offerPrice = getPriceWithDiscount( + getPrice(product), + settings.modules?.list_payments?.discount_option || {}, + ); const productJSONLd: Record = { '@context': 'http://schema.org', '@type': 'Product', @@ -212,10 +216,7 @@ if (apiContext.resource === 'products' && apiContext.doc) { url: canonicalUrl, availability: `${(checkInStock(product) ? 'In' : 'OutOf')}Stock`, priceCurrency: settings.currency, - price: getPriceWithDiscount( - getPrice(product), - settings.modules?.list_payments?.discount_option || {}, - ), + price: Math.round(offerPrice * 100) / 100, itemCondition: 'http://schema.org/' + `${(product.condition !== 'new' ? 'Used' : 'New')}Condition`, seller: {