🛒 PanierGratuit · 0 NahnahPar NAHNAH AI
Note de commande
Champ « note de commande » relié au panier Shopify (cart.note), avec compteur de caractères et option « emballage cadeau » enregistrée comme attribut du panier.
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-panier-note-commande.liquid (Liquid, CSS et JS inclus).
{%- comment -%} NAHNAH AI · Note de commande (bibliothèque Sections & effets) {%- endcomment -%}
<nn-panier-note-commande class="nn-panier-note-commande" 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 }}; --nn-bouton: {{ section.settings.couleur_bouton }}; --nn-texte-bouton: {{ section.settings.couleur_texte_bouton }};">
<form action="{{ routes.cart_url }}" method="post" class="nn-panier-note-commande__formulaire">
<label class="nn-panier-note-commande__label" for="nn-note-{{ section.id }}"><svg class="nn-panier-note-commande__icone" aria-hidden="true" focusable="false" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="5.5" width="18" height="13" rx="2"/><path d="M3.5 7l8.5 6 8.5-6"/></svg>{{ section.settings.titre | escape }}</label>
{%- if section.settings.aide != blank -%}
<p class="nn-panier-note-commande__aide" id="nn-note-aide-{{ section.id }}">{{ section.settings.aide | escape }}</p>
{%- endif -%}
<textarea class="nn-panier-note-commande__champ" id="nn-note-{{ section.id }}" name="note" rows="4" maxlength="{{ section.settings.limite }}" placeholder="{{ section.settings.exemple | escape }}"{% if section.settings.aide != blank %} aria-describedby="nn-note-aide-{{ section.id }}"{% endif %} data-note>{{ cart.note | escape }}</textarea>
{%- if section.settings.cadeau -%}
<input type="hidden" name="attributes[{{ section.settings.texte_cadeau | escape }}]" value="Non">
<label class="nn-panier-note-commande__case">
<input type="checkbox" name="attributes[{{ section.settings.texte_cadeau | escape }}]" value="Oui"{% if cart.attributes[section.settings.texte_cadeau] == 'Oui' %} checked{% endif %}>
<svg class="nn-panier-note-commande__icone" aria-hidden="true" focusable="false" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="9" width="16" height="11" rx="1.5"/><path d="M3 9h18M12 9v11"/><path d="M12 9C10.5 6 7 5.5 7 7.8 7 9 12 9 12 9zm0 0c1.5-3 5-3.5 5-1.2C17 9 12 9 12 9z"/></svg><span>{{ section.settings.texte_cadeau | escape }}</span>
</label>
{%- endif -%}
<div class="nn-panier-note-commande__pied">
<span class="nn-panier-note-commande__compteur" aria-hidden="true"><span data-compte>{{ cart.note.size }}</span> / {{ section.settings.limite }}</span>
<span class="nn-panier-note-commande__cache" data-annonce aria-live="polite"></span>
<button type="submit" name="update" class="nn-panier-note-commande__bouton">{{ section.settings.texte_bouton | escape }}</button>
</div>
</form>
</nn-panier-note-commande>
{% schema %}
{
"name": "Note de commande",
"tag": "section",
"class": "nn-section-panier-note-commande",
"settings": [
{
"type": "text",
"id": "titre",
"label": "Titre",
"default": "Une précision pour ta commande ?"
},
{
"type": "text",
"id": "aide",
"label": "Aide",
"default": "Message cadeau, instructions de livraison… Nous lisons chaque note."
},
{
"type": "text",
"id": "exemple",
"label": "Exemple dans le champ",
"default": "Ex. : merci de ne pas indiquer le prix, c’est un cadeau"
},
{
"type": "range",
"id": "limite",
"label": "Nombre de caractères maximum",
"min": 100,
"max": 1000,
"step": 50,
"default": 500
},
{
"type": "checkbox",
"id": "cadeau",
"label": "Proposer l’emballage cadeau",
"default": true
},
{
"type": "text",
"id": "texte_cadeau",
"label": "Libellé de l’emballage cadeau",
"default": "Emballage cadeau",
"info": "Enregistré comme attribut de la commande (visible dans l’administration)."
},
{
"type": "text",
"id": "texte_bouton",
"label": "Texte du bouton",
"default": "Enregistrer la note"
},
{
"type": "header",
"content": "Couleurs"
},
{
"type": "color",
"id": "couleur_fond",
"label": "Fond",
"default": "#F7F3EE"
},
{
"type": "color",
"id": "couleur_texte",
"label": "Texte",
"default": "#1F1A14"
},
{
"type": "color",
"id": "couleur_accent",
"label": "Accent",
"default": "#B8935A"
},
{
"type": "color",
"id": "couleur_bouton",
"label": "Bouton",
"default": "#1F1A14"
},
{
"type": "color",
"id": "couleur_texte_bouton",
"label": "Texte du bouton",
"default": "#FFFFFF"
},
{
"type": "header",
"content": "Espacement"
},
{
"type": "range",
"id": "marge_haut",
"label": "Marge haute",
"min": 0,
"max": 120,
"step": 4,
"unit": "px",
"default": 32
},
{
"type": "range",
"id": "marge_bas",
"label": "Marge basse",
"min": 0,
"max": 120,
"step": 4,
"unit": "px",
"default": 32
}
],
"presets": [
{
"name": "Note de commande"
}
]
}
{% endschema %}
{% stylesheet %}
.nn-panier-note-commande {
display: block;
padding: var(--nn-mh, 0px) 16px var(--nn-mb, 0px);
background: var(--nn-fond);
color: var(--nn-texte);
}
.nn-panier-note-commande[hidden], .nn-panier-note-commande [hidden] { display: none !important; }
.nn-panier-note-commande *, .nn-panier-note-commande *::before, .nn-panier-note-commande *::after { box-sizing: border-box; }
.nn-panier-note-commande :focus-visible { outline: 3px solid var(--nn-accent); outline-offset: 3px; }
.nn-panier-note-commande__editeur { margin: 0; padding: 16px; font-size: 14px; text-align: center; border: 1px dashed currentColor; opacity: 0.7; }
.nn-panier-note-commande__formulaire { display: grid; gap: 10px; max-width: 640px; margin: 0 auto; padding: 22px; border-radius: 18px; background: color-mix(in srgb, #FFFFFF 60%, var(--nn-fond)); box-shadow: 0 10px 28px color-mix(in srgb, var(--nn-texte) 8%, transparent); }
.nn-panier-note-commande__label { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 700; }
.nn-panier-note-commande__icone { flex: none; width: 22px; height: 22px; color: var(--nn-accent); }
.nn-panier-note-commande__aide { margin: -4px 0 0; font-size: 13px; opacity: 0.72; }
.nn-panier-note-commande__champ { width: 100%; min-height: 110px; padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--nn-texte) 22%, transparent); border-radius: 12px; color: inherit; background: var(--nn-fond); font: inherit; line-height: 1.5; resize: vertical; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.nn-panier-note-commande__champ:focus { border-color: var(--nn-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--nn-accent) 25%, transparent); outline: none; }
.nn-panier-note-commande__case { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.nn-panier-note-commande__case input { width: 20px; height: 20px; margin: 0; accent-color: var(--nn-accent); }
.nn-panier-note-commande__pied { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.nn-panier-note-commande__compteur { font-size: 13px; font-variant-numeric: tabular-nums; opacity: 0.65; }
.nn-panier-note-commande.est-limite .nn-panier-note-commande__compteur { color: #B3122E; opacity: 1; }
.nn-panier-note-commande__bouton {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 8px;
min-height: 44px;
max-width: 100%;
padding: 12px 24px;
border: 0;
border-radius: 999px;
background: var(--nn-bouton);
color: var(--nn-texte-bouton);
font: inherit;
font-weight: 700;
line-height: 1.2;
text-align: center;
text-decoration: none;
cursor: pointer;
transition: transform 0.2s ease, box-shadow 0.2s ease;
}
@media (hover: hover) { .nn-panier-note-commande__bouton:hover { transform: translateY(-2px); box-shadow: 0 8px 20px color-mix(in srgb, var(--nn-bouton) 35%, transparent); } }
.nn-panier-note-commande__bouton:active { transform: scale(0.97); }
.nn-panier-note-commande__cache { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) {
.nn-panier-note-commande, .nn-panier-note-commande *, .nn-panier-note-commande *::before, .nn-panier-note-commande *::after {
animation: none !important;
transition: none !important;
}
}
{% endstylesheet %}
{% javascript %}
if (!customElements.get("nn-panier-note-commande")) {
customElements.define("nn-panier-note-commande", class extends HTMLElement {
connectedCallback() {
if (this.dataset.nnPret) return;
this.dataset.nnPret = "1";
var soi = this;
var champ = this.querySelector("[data-note]");
var compte = this.querySelector("[data-compte]");
var annonce = this.querySelector("[data-annonce]");
if (!champ || !compte) return;
var max = Number(champ.getAttribute("maxlength")) || 500;
var maj = function () {
var n = champ.value.length;
compte.textContent = String(n);
var proche = max - n <= 20;
soi.classList.toggle("est-limite", proche);
// Annonce seulement près de la limite (pas à chaque frappe)
if (annonce) annonce.textContent = proche ? (max - n) + " caractères restants" : "";
};
champ.addEventListener("input", maj);
maj();
}
});
}
{% endjavascript %}
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 : « Note de commande » (Panier)
Description : Champ « note de commande » relié au panier Shopify (cart.note), avec compteur de caractères et option « emballage cadeau » enregistrée comme attribut du panier.
Page de l’élément (aperçu en direct) : https://ai.nahnah.shop/bibliotheque-shopify/panier-note-commande
Fichier : nahnah-panier-note-commande.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-panier-note-commande.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-panier-note-commande ».
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 : panier-note-commande).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-panier-note-commande ».
- 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 panier-note-commande 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