⭐ Avis clientsGratuit · 0 NahnahPar NAHNAH AI
Résumé des avis et répartition
Note moyenne en grand et répartition par étoiles (5 à 1), toutes deux calculées à partir des avis réels saisis, puis la liste des avis.
Aperçu en direct
Données de démonstration (produits, menus, textes d’exemple) : dans ta boutique, ce sont les tiennes.
Photos : Unsplash / Pexels (exemples de l’aperçu, jamais inclus dans le code).
Code à copier
Fichier complet sections/nahnah-avis-resume-repartition.liquid (Liquid, CSS et JS inclus).
{%- comment -%} NAHNAH AI · Résumé des avis (bibliothèque Sections & effets). Moyenne et répartition calculées à partir des avis réels saisis. {%- endcomment -%}
{%- liquid
assign nb_avis = 0
assign total_notes = 0
assign n1 = 0
assign n2 = 0
assign n3 = 0
assign n4 = 0
assign n5 = 0
for block in section.blocks
if block.settings.texte != blank
assign nb_avis = nb_avis | plus: 1
assign total_notes = total_notes | plus: block.settings.note
case block.settings.note
when 1
assign n1 = n1 | plus: 1
when 2
assign n2 = n2 | plus: 1
when 3
assign n3 = n3 | plus: 1
when 4
assign n4 = n4 | plus: 1
else
assign n5 = n5 | plus: 1
endcase
endif
endfor
assign moyenne = 0
if nb_avis > 0
assign moyenne = total_notes | times: 1.0 | divided_by: nb_avis | round: 1
endif
assign moyenne_texte = moyenne | append: '' | replace: '.', ','
-%}
{%- if nb_avis > 0 -%}
<div class="nn-avis-resume-repartition" style="--nn-mh: {{ section.settings.marge_haut }}px; --nn-mb: {{ section.settings.marge_bas }}px; --nn-fond: {{ section.settings.couleur_fond }}; --nn-texte: {{ section.settings.couleur_texte }}; --nn-accent: {{ section.settings.couleur_accent }};">
<div class="nn-avis-resume-repartition__conteneur">
{%- if section.settings.titre != blank -%}<h2 class="nn-avis-resume-repartition__titre">{{ section.settings.titre }}</h2>{%- endif -%}
<div class="nn-avis-resume-repartition__bilan">
<div class="nn-avis-resume-repartition__moyenne">
<p class="nn-avis-resume-repartition__chiffre">{{ moyenne_texte }}<span class="nn-avis-resume-repartition__sur"> / 5</span></p>
<span class="nn-avis-resume-repartition__etoiles" role="img" aria-label="Note : {{ moyenne_texte }} sur 5" style="--nn-pct: {{ moyenne | times: 20 }}%;"><span class="nn-avis-resume-repartition__etoiles-fond" aria-hidden="true">★★★★★</span><span class="nn-avis-resume-repartition__etoiles-plein" aria-hidden="true">★★★★★</span></span>
<p class="nn-avis-resume-repartition__nombre">Calculée sur {{ nb_avis }} avis</p>
</div>
<ul class="nn-avis-resume-repartition__lignes" role="list" aria-label="Répartition des notes">
{%- assign compte = n5 -%}
{%- assign pct = compte | times: 100 | divided_by: nb_avis | floor -%}
<li class="nn-avis-resume-repartition__ligne">
<span class="nn-avis-resume-repartition__ligne-lib">5 étoiles</span>
<span class="nn-avis-resume-repartition__barre" aria-hidden="true"><span style="width: {{ pct }}%;"></span></span>
<span class="nn-avis-resume-repartition__ligne-nb">{{ compte }}<span class="nn-avis-resume-repartition__cache"> avis, soit {{ pct }} %</span></span>
</li>
{%- assign compte = n4 -%}
{%- assign pct = compte | times: 100 | divided_by: nb_avis | floor -%}
<li class="nn-avis-resume-repartition__ligne">
<span class="nn-avis-resume-repartition__ligne-lib">4 étoiles</span>
<span class="nn-avis-resume-repartition__barre" aria-hidden="true"><span style="width: {{ pct }}%;"></span></span>
<span class="nn-avis-resume-repartition__ligne-nb">{{ compte }}<span class="nn-avis-resume-repartition__cache"> avis, soit {{ pct }} %</span></span>
</li>
{%- assign compte = n3 -%}
{%- assign pct = compte | times: 100 | divided_by: nb_avis | floor -%}
<li class="nn-avis-resume-repartition__ligne">
<span class="nn-avis-resume-repartition__ligne-lib">3 étoiles</span>
<span class="nn-avis-resume-repartition__barre" aria-hidden="true"><span style="width: {{ pct }}%;"></span></span>
<span class="nn-avis-resume-repartition__ligne-nb">{{ compte }}<span class="nn-avis-resume-repartition__cache"> avis, soit {{ pct }} %</span></span>
</li>
{%- assign compte = n2 -%}
{%- assign pct = compte | times: 100 | divided_by: nb_avis | floor -%}
<li class="nn-avis-resume-repartition__ligne">
<span class="nn-avis-resume-repartition__ligne-lib">2 étoiles</span>
<span class="nn-avis-resume-repartition__barre" aria-hidden="true"><span style="width: {{ pct }}%;"></span></span>
<span class="nn-avis-resume-repartition__ligne-nb">{{ compte }}<span class="nn-avis-resume-repartition__cache"> avis, soit {{ pct }} %</span></span>
</li>
{%- assign compte = n1 -%}
{%- assign pct = compte | times: 100 | divided_by: nb_avis | floor -%}
<li class="nn-avis-resume-repartition__ligne">
<span class="nn-avis-resume-repartition__ligne-lib">1 étoile</span>
<span class="nn-avis-resume-repartition__barre" aria-hidden="true"><span style="width: {{ pct }}%;"></span></span>
<span class="nn-avis-resume-repartition__ligne-nb">{{ compte }}<span class="nn-avis-resume-repartition__cache"> avis, soit {{ pct }} %</span></span>
</li>
</ul>
</div>
{%- if section.settings.liste -%}
<ul class="nn-avis-resume-repartition__grille" role="list">
{%- for block in section.blocks -%}
{%- if block.settings.texte != blank -%}
<li>
<article class="nn-avis-resume-repartition__carte" {{ block.shopify_attributes }}>
<span class="nn-avis-resume-repartition__etoiles" role="img" aria-label="Note : {{ block.settings.note }} sur 5" style="--nn-pct: {{ block.settings.note | times: 20 }}%;"><span class="nn-avis-resume-repartition__etoiles-fond" aria-hidden="true">★★★★★</span><span class="nn-avis-resume-repartition__etoiles-plein" aria-hidden="true">★★★★★</span></span>
<blockquote class="nn-avis-resume-repartition__texte"><p>{{ block.settings.texte | escape | newline_to_br }}</p></blockquote>
{%- if section.settings.photos and block.settings.photo != blank -%}
{{ block.settings.photo | image_url: width: 480 | image_tag: loading: 'lazy', sizes: '(min-width: 750px) 240px, 50vw', widths: '240, 480', class: 'nn-avis-resume-repartition__photo', alt: 'Photo envoyée par le client' }}
{%- endif -%}
<footer class="nn-avis-resume-repartition__pied">
<span class="nn-avis-resume-repartition__nom">{{ block.settings.prenom | default: 'Client' | escape }}</span>
{%- if block.settings.date != blank -%}<span class="nn-avis-resume-repartition__date">{{ block.settings.date | escape }}</span>{%- endif -%}
{%- if block.settings.achat_verifie -%}<span class="nn-avis-resume-repartition__verifie"><span aria-hidden="true">✓</span> Achat vérifié</span>{%- endif -%}
{%- if block.settings.produit != blank -%}<a class="nn-avis-resume-repartition__produit" href="{{ block.settings.produit.url }}"><span class="nn-avis-resume-repartition__cache">Produit acheté : </span>{{ block.settings.produit.title | escape }}</a>{%- endif -%}
</footer>
</article>
</li>
{%- endif -%}
{%- endfor -%}
</ul>
{%- endif -%}
{%- if section.settings.mention != blank -%}<p class="nn-avis-resume-repartition__mention">{{ section.settings.mention | escape }}</p>{%- endif -%}
</div>
</div>
{%- elsif request.design_mode -%}
<div class="nn-avis-resume-repartition__conteneur"><p class="nn-avis-resume-repartition__vide">Aucun avis affiché : ajoute de vrais avis avec « Ajouter un bloc » → Avis. La section reste invisible sur la boutique tant qu’aucun avis n’est saisi.</p></div>
{%- endif -%}
{% schema %}
{
"name": "Résumé des avis",
"tag": "section",
"class": "nn-section-avis-resume-repartition",
"max_blocks": 50,
"settings": [
{
"type": "inline_richtext",
"id": "titre",
"label": "Titre",
"default": "Avis clients"
},
{
"type": "checkbox",
"id": "liste",
"label": "Afficher aussi la liste des avis",
"default": true
},
{
"type": "checkbox",
"id": "photos",
"label": "Afficher les photos des clients",
"default": true
},
{
"type": "textarea",
"id": "mention",
"label": "Mention sur les avis (sous la liste)",
"default": "Avis saisis par la boutique à partir des messages reçus de ses clients, sans modification. « Achat vérifié » : une commande correspondante a été retrouvée."
},
{
"type": "header",
"content": "Couleurs"
},
{
"type": "color",
"id": "couleur_fond",
"label": "Fond",
"default": "#FFFFFF"
},
{
"type": "color",
"id": "couleur_texte",
"label": "Texte",
"default": "#14213D"
},
{
"type": "color",
"id": "couleur_accent",
"label": "Accent",
"default": "#FCA311"
},
{
"type": "header",
"content": "Espacement"
},
{
"type": "range",
"id": "marge_haut",
"label": "Marge haute",
"min": 0,
"max": 120,
"step": 4,
"unit": "px",
"default": 48
},
{
"type": "range",
"id": "marge_bas",
"label": "Marge basse",
"min": 0,
"max": 120,
"step": 4,
"unit": "px",
"default": 48
}
],
"blocks": [
{
"type": "avis",
"name": "Avis",
"settings": [
{
"type": "paragraph",
"content": "Saisis uniquement un avis réellement reçu, sans le modifier. Inventer, acheter ou réécrire des avis est interdit (pratique commerciale trompeuse)."
},
{
"type": "text",
"id": "prenom",
"label": "Prénom ou initiale du client"
},
{
"type": "range",
"id": "note",
"label": "Note sur 5",
"min": 1,
"max": 5,
"step": 1,
"default": 5
},
{
"type": "textarea",
"id": "texte",
"label": "Texte de l’avis (tel que reçu)"
},
{
"type": "text",
"id": "date",
"label": "Date de l’avis (ex. 12 mars 2026)"
},
{
"type": "image_picker",
"id": "photo",
"label": "Photo envoyée par le client (facultative)"
},
{
"type": "product",
"id": "produit",
"label": "Produit acheté (facultatif)"
},
{
"type": "checkbox",
"id": "achat_verifie",
"label": "Achat vérifié : coche seulement si tu as retrouvé la commande",
"default": false
}
]
}
],
"presets": [
{
"name": "Résumé des avis"
}
]
}
{% endschema %}
{% stylesheet %}
.nn-avis-resume-repartition {
padding: var(--nn-mh) 0 var(--nn-mb);
background: var(--nn-fond);
color: var(--nn-texte);
}
.nn-avis-resume-repartition__conteneur {
max-width: 1200px;
margin: 0 auto;
padding: 0 16px;
}
.nn-avis-resume-repartition__titre {
margin: 0;
font-size: clamp(24px, 4vw, 36px);
line-height: 1.2;
color: inherit;
}
.nn-avis-resume-repartition__cache {
position: absolute !important;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0 0 0 0);
white-space: nowrap;
border: 0;
}
.nn-avis-resume-repartition__vide {
margin: 0;
padding: 16px;
border: 1px dashed currentColor;
border-radius: 12px;
font-size: 14px;
opacity: 0.8;
}
.nn-avis-resume-repartition__etoiles {
position: relative;
display: inline-block;
flex: none;
color: var(--nn-accent);
font-size: var(--nn-taille-etoiles, 18px);
line-height: 1;
letter-spacing: 2px;
white-space: nowrap;
}
.nn-avis-resume-repartition__etoiles-fond { opacity: 0.25; }
.nn-avis-resume-repartition__etoiles-plein {
position: absolute;
inset-block: 0;
inset-inline-start: 0;
width: var(--nn-pct, 100%);
overflow: hidden;
}
.nn-avis-resume-repartition__resume {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 6px 10px;
margin: 0;
}
.nn-avis-resume-repartition__carte {
display: flex;
flex-direction: column;
gap: 12px;
height: 100%;
padding: 20px;
border: 1px solid color-mix(in srgb, var(--nn-texte) 10%, transparent);
border-radius: 16px;
background: color-mix(in srgb, var(--nn-texte) 4%, var(--nn-fond));
}
.nn-avis-resume-repartition__texte {
margin: 0;
font-size: 16px;
line-height: 1.6;
overflow-wrap: anywhere;
}
.nn-avis-resume-repartition__texte p { margin: 0; }
.nn-avis-resume-repartition__photo {
display: block;
width: 96px;
height: 96px;
object-fit: cover;
border-radius: 10px;
}
.nn-avis-resume-repartition__pied {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 4px 10px;
margin-top: auto;
font-size: 14px;
}
.nn-avis-resume-repartition__nom { font-weight: 700; }
.nn-avis-resume-repartition__date { opacity: 0.65; }
.nn-avis-resume-repartition__verifie {
display: inline-flex;
align-items: center;
gap: 4px;
padding: 2px 8px;
border-radius: 999px;
background: color-mix(in srgb, #1F8A5B 18%, transparent);
font-size: 12px;
font-weight: 600;
}
.nn-avis-resume-repartition__produit {
flex-basis: 100%;
color: inherit;
font-size: 13px;
opacity: 0.75;
text-underline-offset: 3px;
}
.nn-avis-resume-repartition__produit:focus-visible {
outline: 3px solid var(--nn-accent);
outline-offset: 2px;
}
.nn-avis-resume-repartition__mention {
max-width: 70ch;
margin: 20px 0 0;
font-size: 12px;
opacity: 0.65;
}
.nn-avis-resume-repartition__titre { margin-bottom: 20px; }
.nn-avis-resume-repartition__bilan {
display: grid;
gap: 24px;
padding: 24px;
border-radius: 18px;
background: color-mix(in srgb, var(--nn-texte) 4%, var(--nn-fond));
}
@media (min-width: 750px) {
.nn-avis-resume-repartition__bilan {
grid-template-columns: 220px minmax(0, 1fr);
align-items: center;
gap: 40px;
}
}
.nn-avis-resume-repartition__moyenne {
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 6px;
--nn-taille-etoiles: 22px;
}
.nn-avis-resume-repartition__chiffre {
margin: 0;
font-size: 56px;
font-weight: 800;
line-height: 1;
}
.nn-avis-resume-repartition__sur {
font-size: 20px;
font-weight: 500;
opacity: 0.6;
}
.nn-avis-resume-repartition__nombre {
margin: 0;
font-size: 14px;
opacity: 0.7;
}
.nn-avis-resume-repartition__lignes {
display: flex;
flex-direction: column;
gap: 10px;
margin: 0;
padding: 0;
list-style: none;
}
.nn-avis-resume-repartition__ligne {
display: grid;
grid-template-columns: 72px minmax(0, 1fr) 32px;
align-items: center;
gap: 12px;
font-size: 14px;
}
.nn-avis-resume-repartition__barre {
height: 10px;
overflow: hidden;
border-radius: 999px;
background: color-mix(in srgb, var(--nn-texte) 12%, transparent);
}
.nn-avis-resume-repartition__barre span {
display: block;
height: 100%;
border-radius: inherit;
background: var(--nn-accent);
}
.nn-avis-resume-repartition__ligne-nb {
text-align: end;
font-variant-numeric: tabular-nums;
}
.nn-avis-resume-repartition__grille {
display: grid;
grid-template-columns: minmax(0, 1fr);
gap: 16px;
margin: 24px 0 0;
padding: 0;
list-style: none;
}
@media (min-width: 750px) {
.nn-avis-resume-repartition__grille { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 990px) {
.nn-avis-resume-repartition__grille { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
.nn-avis-resume-repartition * {
animation: none !important;
transition: none !important;
}
}
{% endstylesheet %}
Licence NAHNAH AI : utilisation libre dans tes boutiques (y compris commerciales), modification permise, revente de l’élément seul interdite.
Prompt à copier
À coller dans Claude ou ChatGPT avec le fichier téléchargé (ou le code copié) : l’assistant t’aide à l’installer et à l’adapter à ta marque.
Tu es un expert des thèmes Shopify Online Store 2.0. Aide-moi à installer puis à adapter à ma marque cet élément gratuit de la bibliothèque NAHNAH AI.
Élément : « Résumé des avis et répartition » (Avis clients)
Description : Note moyenne en grand et répartition par étoiles (5 à 1), toutes deux calculées à partir des avis réels saisis, puis la liste des avis.
Page de l’élément (aperçu en direct) : https://ai.nahnah.shop/bibliotheque-shopify/avis-resume-repartition
Fichier : nahnah-avis-resume-repartition.liquid (bouton « Télécharger » de la page) ou le code copié avec le bouton « Copier » : je te le joins ou je le colle après ce message.
Emplacement dans le thème : sections/nahnah-avis-resume-repartition.liquid (Liquid, puis {% stylesheet %} et {% javascript %}, dans ce seul fichier).
Étapes d’installation :
1. Dans Shopify : Boutique en ligne → Thèmes → bouton « … » du thème → Modifier le code.
2. Dossier « sections » → « Ajouter une section » (ou « Nouveau fichier ») → nomme-la « nahnah-avis-resume-repartition ».
3. Efface le contenu proposé, colle le code de l’onglet Liquid (fichier complet), puis Enregistrer.
4. Ouvre Personnaliser → Ajouter une section → choisis-la, règle les textes et les couleurs, puis Enregistrer.
Ce que j’attends de toi :
- Guide-moi pas à pas dans Shopify : Boutique en ligne → Thèmes → « … » → Modifier le code → dossier sections → Ajouter une section, puis Personnaliser → Ajouter une section.
- Propose-moi d’adapter les couleurs, les textes et les liens à ma marque : demande d’abord mes couleurs (codes hexadécimaux), mon ton et mes liens.
- Garde le bloc {% schema %} et tous ses réglages (identifiants, types, presets) : je dois pouvoir tout régler ensuite dans l’éditeur de thème.
- Rends-moi le fichier complet modifié, prêt à coller, sans faux avis, fausse urgence ni chiffre inventé.
Si tu as le connecteur NAHNAH AI (MCP), récupère directement le code exact avec l’outil obtenir_code_element (id : avis-resume-repartition).Installer dans ma boutique
En un clic, la section est ajoutée à un thème de ta boutique Shopify connectée (un thème non publié par défaut).
Chargement de tes boutiques…
Installer dans Shopify
- Dans Shopify : Boutique en ligne → Thèmes → bouton « … » du thème → Modifier le code.
- Dossier « sections » → « Ajouter une section » (ou « Nouveau fichier ») → nomme-la « nahnah-avis-resume-repartition ».
- Efface le contenu proposé, colle le code de l’onglet Liquid (fichier complet), puis Enregistrer.
- Ouvre Personnaliser → Ajouter une section → choisis-la, règle les textes et les couleurs, puis Enregistrer.
Installer via le MCP
Depuis Claude, Claude Code ou ChatGPT connecté à NAHNAH AI, demande : « Donne-moi le code de l’élément avis-resume-repartition de la bibliothèque NAHNAH AI et les étapes pour l’installer ». L’assistant récupère le code et les étapes (outil obtenir_code_element), gratuitement.
Boutique connectée à NAHNAH AI : l’assistant peut aussi l’installer directement (outil installer_element).
Connecter le MCP