Skip to content

[5.x] - Fix product structured data on PDP - #1302

Open
JimmyHoenderdaal wants to merge 5 commits into
masterfrom
feature/pdp-rich-snippets
Open

[5.x] - Fix product structured data on PDP#1302
JimmyHoenderdaal wants to merge 5 commits into
masterfrom
feature/pdp-rich-snippets

Conversation

@JimmyHoenderdaal

@JimmyHoenderdaal JimmyHoenderdaal commented Jun 2, 2026

Copy link
Copy Markdown
Member

This adds some extra microdata inside the schema Offer:
<meta itemprop="itemCondition" content="https://schema.org/NewCondition" />
priceValidUntil

Both are recommended to add inside the schema.

Internal ref: RAP-1899

Comment thread resources/views/product/partials/microdata.blade.php Outdated
Comment thread resources/views/product/partials/microdata.blade.php Outdated
Jade-GG
Jade-GG previously approved these changes Jun 10, 2026
Comment thread resources/views/product/partials/microdata.blade.php Outdated
Comment thread resources/views/product/partials/microdata.blade.php Outdated
Comment thread resources/views/components/breadcrumb.blade.php Outdated
@Roene-JustBetter Roene-JustBetter changed the title fix product structured data on pdp [5.x] - Fix product structured data on PDP Jul 22, 2026
<meta itemprop="url" content="{{ url($product->url) }}" />
@if ($product->special_to_date && $product->special_to_date > now()->toDateTimeString())
<meta itemprop="priceValidUntil" content="{{ $product->special_to_date }}" />
@php $specialToDate = $product->raw('special_to_date'); @endphp

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need the raw()?

@Roene-JustBetter Roene-JustBetter Aug 11, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normal $product->special_to_date access runs the value through HTML-escaping meant for display text, which turns the underlying Carbon date into a plain string. raw() skips that and returns the attribute's cast value directly — a real Carbon instance, since AttributeDatetime casts it to 'datetime'. The template needs that Carbon object to call ->isFuture() and ->format('Y-m-d').

RAP-2010 created to remove html escaping from EAV dates

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants