Repository navigation
[5.x] - Fix product structured data on PDP - #1302
Merged
Merged
Conversation
Jade-GG
requested changes
Jun 2, 2026
added 2 commits
June 2, 2026 12:48
Jade-GG
previously approved these changes
Jun 10, 2026
royduin
reviewed
Jun 30, 2026
royduin
reviewed
Jun 30, 2026
royduin
reviewed
Jun 30, 2026
royduin
reviewed
Jul 22, 2026
Roene-JustBetter
marked this pull request as draft
September 29, 2026 12:43
Merged
…nto feature/pdp-rich-snippets
Member
There was a problem hiding this comment.
I have double checked this f2f with @indykoning to check if change is correct. Short explain from Claude:
When you read $product->special_to_date, the value() accessor runs:
- rawValue casts the database string to a Carbon object, because AttributeDatetime casts value to datetime.
- value() then calls collect($value) so it can handle single and multiple values the same way.
- This is where it went wrong. collect() turns anything JsonSerializable into its JSON form, and Carbon is JsonSerializable. So the Carbon became the string "2030-01-01T00:00:00.000000Z".
- The ! is_string() check from Only escape strings #1446 runs after that, so it only ever saw a string. The fix never applied to dates.
The change: Arr::wrap() turns a single value like Carbon into [$carbon] without changing it. Arrays and Collections are still passed to collect() as before. The Carbon now reaches the #1446 check unchanged, so you get a real date object back and ->isFuture() and ->format() work in the template.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds some extra microdata inside the schema Offer:
<meta itemprop="itemCondition" content="https://schema.org/NewCondition" />priceValidUntilBoth are recommended to add inside the schema.
Internal ref: RAP-1899