> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.revie.ai/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# Schema de reseñas para Google en Shopify

Agrega datos estructurados de tipo `Review` y `AggregateRating` en tus páginas de producto para que Google muestre las estrellas en los resultados de búsqueda.

1. Elige la versión que necesitas
Hay dos variantes del schema. Elige según qué tan completo quieres el Rich Result en Google. NO necesitas agregar las dos.

### Básica
*Solo AggregateRating*
Muestra el puntaje promedio y el número de reseñas en Google. Opción rápida y suficiente para la mayoría.
* Menos de 10 líneas de código
* Funciona con los metafields estándar de Shopify

### Completa 
*AggregateRating + Reviews*
Incluye hasta 3 reseñas individuales con texto, autor y fecha. Rich Result más completo en Google.
* Mayor visibilidad en búsquedas
* Fragmentos enriquecidos más detallados


2. Copia el código
Selecciona la versión que elegiste y copia el snippet completo.

### Versión Básica
```
{% if template contains 'product' and product.metafields.reviews.rating.value != blank %}
<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "Product",
  "name": {{ product.title | json }},
  "aggregateRating": {
    "@type": "AggregateRating",
    "ratingValue": "{{ product.metafields.reviews.rating.value }}",
    "reviewCount": "{{ product.metafields.reviews.rating_count }}"
  }
}
</script>
{% endif %}
```


### Versión Completa
```
{% if template contains 'product' and product.metafields.reviews.rating.value != blank %}
{% assign raw_reviews_str = product.metafields.revie.reviewProductList | default: '[]' %}
{% assign raw_reviews = raw_reviews_str | parse_json %}

{%- capture reviews_items -%}
  {%- assign added = 0 -%}
  {%- for r in raw_reviews -%}
    {%- if r.comment and r.comment != '' and added < 3 -%}
      {%- if added > 0 -%},{%- endif -%}
      {
        "@type": "Review",
        "author": { "@type": "Person",
          "name": {{ r.customer.firstName | append: " " | append: r.customer.lastName | strip | default: "Cliente verificado" | json }}
        },
        "datePublished": "{{ r.createdAt | date: '%Y-%m-%d' }}",
        "reviewBody": {{ r.comment | strip_html | json }},
        "reviewRating": {
          "@type": "Rating",
          "ratingValue": "{{ r.stars }}",
          "bestRating": "5",
          "worstRating": "1"
        }
      }
      {%- assign added = added | plus: 1 -%}
    {%- endif -%}
  {%- endfor -%}
{%- endcapture -%}

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "Product",
  "name": {{ product.title | json }},
  "aggregateRating": {
    "@type": "AggregateRating",
    "ratingValue": "{{ product.metafields.reviews.rating.value }}",
    "reviewCount": "{{ product.metafields.reviews.rating_count }}"
  }
  {%- if reviews_items != blank -%}
  ,"review": [{{ reviews_items }}]
  {%- endif -%}
}
</script>
{% endif %}
```


3. Pega el código en `theme.liquid`

Ve al editor de código de tu tema en Shopify y sigue estos pasos:
* En tu panel de Shopify ve a **Tienda en línea → Temas**, haz clic en los tres puntos de tu tema activo y elige **Editar código**.
* En la columna izquierda, bajo la carpeta **Layout**, abre el archivo `theme.liquid`.
* Pega el snippet **antes del cierre** de la etiqueta `</head>`.
* Haz clic en **Guardar**.


4. Verifica que el schema funciona

Usa la herramienta oficial de Google para confirmar que el schema se generó correctamente
| https://search.google.com/test/rich-results
*Pega la URL de cualquier página de producto de tu tienda y busca el tipo `Product` con `aggregateRating`.*

