i am having error with my json always give me error when i put in rich test result {% if product.compare_at_price > 0 %} and this {% if rating_count > 0 or product.reviews.size > 0 %},{% endif %} can anyone help me
Topic summary
A user is encountering a JSON parsing error in Shopify Liquid code when implementing structured data for rich results. The error message indicates “Missing ‘,’ or ‘}’” and occurs specifically at the line containing {% if product.rating_count > 0 %}.
Key details:
- The problematic code appears to be for aggregate rating schema markup
- The error occurs in Google’s Rich Results Test
- Variables like
product.rating_count,product.average_rating, andproduct.compare_at_priceare being used
Current status:
- Another user asked for clarification about whether the variables are properly defined and accessible
- The original poster confirmed the variables are accessible but the parsing error persists
- The issue remains unresolved, with the conversation appearing to be in early troubleshooting stages
Hi,
Are variables defined and accessible?
yes it’s always that same error in rich result test saying Parsing error: Missing ‘,’ or ‘}’ :
},
{% if product.rating_count > 0 %} ----ERROR line
“aggregateRating”: {
“@type”: “AggregateRating”,
“ratingValue”: “{{ product.average_rating }}”,
“reviewCount”: “{{ product.rating_count }}”