Skip to content

Commit

Permalink
Merge pull request #2355 from graphcommerce-org/fix/json-ld-product-r…
Browse files Browse the repository at this point in the history
…eview-fix

chore: add early return when there are no reviews to prevent invalid enhanced results
  • Loading branch information
paales authored Aug 21, 2024
2 parents 4b303a4 + 82b4ed9 commit e2f1c18
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/hungry-balloons-divide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphcommerce/magento-review': patch
---

Add early return when there are no reviews to prevent invalid enhanced results.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export function jsonLdProductReview(
): Pick<Product, 'aggregateRating' | 'review'> {
const { reviews, review_count, rating_summary } = props

if (!review_count) return {}

return {
aggregateRating: {
'@type': 'AggregateRating',
Expand Down

0 comments on commit e2f1c18

Please sign in to comment.