From 57037fc435f48fd4e26ee8926d156d5c39dcf508 Mon Sep 17 00:00:00 2001 From: isUnknown Date: Fri, 19 Dec 2025 18:05:37 +0100 Subject: [PATCH] Fix multilingual support for product data and thank you redirect MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add translate: false to price, hasOptions, and optionValues fields - Make thank you page redirect language-aware (detects /fr/ prefix) - Ensure stock, weight, dimensions, and options are shared between languages 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- assets/js/snipcart.js | 7 ++++++- site/blueprints/pages/product.yml | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/assets/js/snipcart.js b/assets/js/snipcart.js index fd6946a..0e0dfee 100644 --- a/assets/js/snipcart.js +++ b/assets/js/snipcart.js @@ -7,7 +7,12 @@ window.SnipcartSettings = { // Redirection après paiement réussi document.addEventListener('snipcart.ready', function() { Snipcart.execute('bind', 'order.completed', function(order) { - window.location.href = '/thanks?order=' + order.token; + // Détecter la langue actuelle depuis l'URL + const currentPath = window.location.pathname; + const langMatch = currentPath.match(/^\/([a-z]{2})(\/|$)/); + const langPrefix = langMatch ? '/' + langMatch[1] : ''; + + window.location.href = langPrefix + '/thanks?order=' + order.token; }); }); diff --git a/site/blueprints/pages/product.yml b/site/blueprints/pages/product.yml index 4421e9e..52fde12 100644 --- a/site/blueprints/pages/product.yml +++ b/site/blueprints/pages/product.yml @@ -22,6 +22,7 @@ tabs: min: 0 step: 0.01 required: true + translate: false width: 1/4 stock: label: Stock @@ -99,6 +100,7 @@ tabs: fr: Options type: toggle default: false + translate: false width: 1/7 optionLabel: label: @@ -116,6 +118,7 @@ tabs: help: en: "Comma-separated values (e.g.: XS, S, M, L, XL)" fr: "Valeurs séparées par des virgules (ex: XS, S, M, L, XL)" + translate: false when: hasOptions: true width: 3/7