Skip to content

Fix product schema image and price validity - #1091

Open
mihailovs2000 wants to merge 1 commit into
PrestaShop:developfrom
mihailovs2000:fix/product-schema-offer-accuracy
Open

Fix product schema image and price validity#1091
mihailovs2000 wants to merge 1 commit into
PrestaShop:developfrom
mihailovs2000:fix/product-schema-offer-accuracy

Conversation

@mihailovs2000

Copy link
Copy Markdown

Summary

  • use the original product cover URL in Product.image instead of the 250 x 250 home_default thumbnail
  • omit Offer.priceValidUntil when the catalog has no actual price-expiry date

Why

priceValidUntil means the date after which the displayed price is no longer available. Generating an arbitrary date 15 days in the future publishes data that is not backed by catalog state and changes on every render. Omitting it is accurate when no validity date exists.

The full product cover is also a better structured-data image than the small listing thumbnail and is already exposed by the product presenter.

Reference: https://developers.google.com/search/docs/appearance/structured-data/product-snippet#offer-properties

Test

  • reviewed the rendered JSON-LD template paths for products with and without a cover
  • verified the trailing commas remain valid with priceValidUntil removed

@ps-jarvis

Copy link
Copy Markdown

Hello @mihailovs2000!

This is your first pull request on hummingbird repository of the PrestaShop project.

Thank you, and welcome to this Open Source community!

@github-project-automation github-project-automation Bot moved this to Ready for review in PR Dashboard Aug 12, 2026
@Hlavtox

Hlavtox commented Aug 13, 2026

Copy link
Copy Markdown
Member

Hello @mihailovs2000, starting with 9.2, structured data are now sent from the core directly. The images are made differently.

priceValidUntil is still there, but you can easily override it via a module. See the example module I made - https://github.com/PrestaShop/example-modules/tree/master/demoseo.

But, maybe we can remove it indeed. Or maybe improve it so that it reflects the validity of specific price, if the product is discounted?

@tblivet

tblivet commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Hi @mihailovs2000, thanks for the PR!

As @Hlavtox mentioned above, the images are built differently since 9.2 the core now does it in ProductController::getStructuredData() so the image part can be dropped.

And on the second point @Hlavtox raised, rather than removing priceValidUntil, I think we could improve the current code for when the product is discounted. It seems we already have the information available to make the data correct in the JSON-LD, since the value is exposed as $product.specific_prices.to.

So this to test and format the data:

{assign var=priceValidUntil value=false}

{if !empty($product.specific_prices.to) && $product.specific_prices.to != '0000-00-00 00:00:00'}
  {assign var=priceValidUntil value=$product.specific_prices.to|date_format:'%Y-%m-%d'}
{/if}

and this to output it in the structure should be enough:

{if $priceValidUntil}"priceValidUntil": {$priceValidUntil|json_encode nofilter},{/if}

What do you think, @mihailovs2000, @Hlavtox?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Ready for review

Development

Successfully merging this pull request may close these issues.

4 participants