From 3ba37020ffc96a55fa7e70f70e8069458963ce10 Mon Sep 17 00:00:00 2001 From: isUnknown Date: Mon, 22 Dec 2025 10:21:28 +0100 Subject: [PATCH] Fix Snipcart v3 API compatibility for order completion redirect MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update event listener from deprecated v2 Snipcart.execute to v3 Snipcart.events.on API. Change event from 'order.completed' (webhook-only) to 'cart.confirmed' (client-side) and update parameter from order to cartState to match v3 structure. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- assets/js/snipcart.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/js/snipcart.js b/assets/js/snipcart.js index 0e0dfee..13eef65 100644 --- a/assets/js/snipcart.js +++ b/assets/js/snipcart.js @@ -6,13 +6,13 @@ window.SnipcartSettings = { // Redirection après paiement réussi document.addEventListener('snipcart.ready', function() { - Snipcart.execute('bind', 'order.completed', function(order) { + Snipcart.events.on('cart.confirmed', function(cartState) { // 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; + window.location.href = langPrefix + '/thanks?order=' + cartState.token; }); });