• GRATIS verzending vanaf €75,-
  • Voor 16:00u besteld - Dezelfde dag verzonden.
  • Online & offline bag boutique

4.8Out of 180 Reviews

Producten getagd met Bear Design Telefoontasje Igor CP2376 Pink

0 Producten


    Seen 0 of the 0 products

    Inloggen

    Wachtwoord vergeten?

    • Al je orders en retouren op één plek
    • Het bestelproces gaat nog sneller
    • Je winkelwagen is altijd en overal opgeslagen

    vergelijk0

    /** * Xendy verlaten-winkelwagen-snippet voor Lightspeed eCom C-Series. * * Plak dit script in de Lightspeed-backoffice onder * Settings → Website Settings → Web Extras → Custom JavaScript * en vul hieronder de datalayer-token van de company in (zie README.md). * * Spreekt exact hetzelfde contract als de Xendy WooCommerce-plugin * (datalayer/woocommerce/plugin): store-uuid-in-db → store-shopping-cart / * store-customer-details → handle-order-processed → restore-shopping-cart. */ (function () { "use strict"; var HOST = "https://datalayer.nextmessage.nl"; var TOKEN = "711ef605-b474-4b7a-9786-d249052d82c0"; var COOKIE_NAME = "nextmessage_cookie"; var LINK_PARAM = "nextmessage_uuid"; // cross-domain doorgifte shop → checkout (*.webshopapp.com) var RESTORE_PARAM = "nextmessage_shopping_cart"; // herstel-link uit de Xendy-mail var CUSTOMER_CACHE_KEY = "nextmessage_checkout_customer"; // gelezen door de thank-you-tracking-code var CART_CACHE_KEY = "nextmessage_last_cart"; function debug() { try { if (localStorage.getItem("nextmessage_debug") === "1") { console.log.apply(console, ["[xendy]"].concat([].slice.call(arguments))); } } catch (e) {} } if (TOKEN.indexOf("VUL-HIER") === 0) { debug("Geen datalayer-token ingevuld — snippet doet niets."); return; } function getCookie(name) { var cookies = document.cookie.split(";"); for (var i = 0; i < cookies.length; i++) { var cookie = cookies[i].trim(); if (cookie.indexOf(name + "=") === 0) return cookie.substring(name.length + 1); } return null; } function setCookie(name, value) { // 10 jaar geldig, net als de cookie van de WooCommerce-plugin var expires = new Date(Date.now() + 10 * 365 * 24 * 60 * 60 * 1000).toUTCString(); document.cookie = name + "=" + value + "; expires=" + expires + "; path=/; SameSite=Lax"; } function generateUuid() { // 32 tekens, zelfde lengte als de cookie van de WooCommerce-plugin var bytes = new Uint8Array(16); window.crypto.getRandomValues(bytes); var out = ""; for (var i = 0; i < bytes.length; i++) out += ("0" + bytes[i].toString(16)).slice(-2); return out; } function getParam(name) { try { return new URL(location.href).searchParams.get(name); } catch (e) { return null; } } function stripParam(name) { try { var url = new URL(location.href); url.searchParams.delete(name); history.replaceState(null, "", url.toString()); } catch (e) {} } function post(path, payload) { payload.datalayer_token = TOKEN; payload.user_agent = navigator.userAgent; payload.current_page_url = location.href; return fetch(HOST + "/wordpress-plugin/" + path, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload), keepalive: true }); } function isCheckoutPage() { return /checkout/i.test(location.pathname) || /^checkout\./i.test(location.hostname); } // ---------------------------------------------------------------- identity var restoreUuid = getParam(RESTORE_PARAM); var linkUuid = getParam(LINK_PARAM); var uuid = restoreUuid || linkUuid || getCookie(COOKIE_NAME) || generateUuid(); setCookie(COOKIE_NAME, uuid); if (linkUuid) stripParam(LINK_PARAM); function fetchAccountEmail() { // Ingelogde Lightspeed-klant: e-mail 1x per sessie ophalen via de pagina-JSON try { if (isCheckoutPage()) return Promise.resolve(null); var cached = sessionStorage.getItem("nextmessage_account_email"); if (cached !== null) return Promise.resolve(cached || null); return fetch("/account/?format=json", { credentials: "same-origin" }) .then(function (r) { return r.json(); }) .then(function (j) { var email = (j && j.customer && j.customer.email) || (j && j.account && j.account.email) || (j && j.user && j.user.email) || ""; sessionStorage.setItem("nextmessage_account_email", email); return email || null; }) .catch(function () { sessionStorage.setItem("nextmessage_account_email", ""); return null; }); } catch (e) { return Promise.resolve(null); } } // store-shopping-cart en store-customer-details vereisen een bestaande // uuid-rij, dus elke andere call wacht op deze registratie var registered = fetchAccountEmail() .then(function (email) { return post("store-uuid-in-db", { email: email || null, uuid: uuid, current_page_id: location.pathname || "/" }) .then(function (r) { return r.json(); }) .then(function (data) { if (data && data.uuid && data.uuid !== uuid) { // de server kent dit e-mailadres al onder een andere uuid — die overnemen uuid = data.uuid; setCookie(COOKIE_NAME, uuid); } return uuid; }); }) .catch(function (e) { debug("store-uuid-in-db faalde", e); return uuid; }); // ---------------------------------------------------------------- cart-sync function extractCartProducts(json) { var lines = (json && json.cart && json.cart.products) || (json && json.cart && json.cart.items) || (json && json.products) || []; if (!Array.isArray(lines)) { lines = Object.keys(lines).map(function (k) { return lines[k]; }); } return lines .map(function (line) { var product = line.product || line; var variant = line.variant || {}; return { // id = Lightspeed product-id: matcht de sku-kolom van de Xendy-productimport (mailblok-lookup) id: Number(product.id || line.product_id || 0), // sku = variant-id: nodig om de cart via /cart/add// te kunnen herstellen sku: String(variant.id || product.variant_id || product.vid || line.variant_id || ""), name: String(product.fulltitle || product.title || line.title || line.name || ""), quantity: Number(line.quantity || line.amount || 1) }; }) .filter(function (p) { return p.id > 0; }); } function syncCart() { if (isCheckoutPage()) return; fetch("/cart/?format=json", { credentials: "same-origin", headers: { Accept: "application/json" } }) .then(function (r) { return r.json(); }) .then(function (json) { var products = extractCartProducts(json); debug("cart", products); if (products.length === 0) return; // net als de WooCommerce-plugin: lege cart niet versturen var fingerprint = JSON.stringify(products); if (sessionStorage.getItem(CART_CACHE_KEY) === fingerprint) return; registered.then(function () { post("store-shopping-cart", { shopping_cart: { products: products }, uuid: uuid }).then( function (r) { if (r.ok) sessionStorage.setItem(CART_CACHE_KEY, fingerprint); } ); }); }) .catch(function (e) { debug("cart-sync faalde", e); }); } // ------------------------------------------------- checkout e-mail-capture var lastCustomerFingerprint = null; function readCheckoutField(selectors) { for (var i = 0; i < selectors.length; i++) { var el = document.querySelector(selectors[i]); if (el && el.value) return el.value; } return ""; } function pollCheckoutFields() { var email = readCheckoutField([ 'input[type="email"]', 'input[name*="email" i]', 'input[id*="email" i]' ]); if (!email || email.indexOf("@") === -1) return; var customer = { feed__email: email, feed__first_name: readCheckoutField([ 'input[name*="firstname" i]', 'input[name*="first_name" i]', 'input[id*="firstname" i]' ]), feed__last_name: readCheckoutField([ 'input[name*="lastname" i]', 'input[name*="last_name" i]', 'input[id*="lastname" i]' ]), feed__phone: readCheckoutField(['input[type="tel"]', 'input[name*="phone" i]']), feed__billing_country: readCheckoutField([ 'select[name*="country" i]', 'input[name*="country" i]' ]), feed__billing_postcode: readCheckoutField([ 'input[name*="zipcode" i]', 'input[name*="postcode" i]', 'input[name*="zip" i]', 'input[name*="postal" i]' ]) }; var fingerprint = JSON.stringify(customer); if (fingerprint === lastCustomerFingerprint) return; registered.then(function () { customer.uuid = uuid; post("store-customer-details", customer).then(function (r) { if (r.ok) { lastCustomerFingerprint = fingerprint; try { // zelfde domein als de bedanktpagina; de thank-you-tracking-code leest dit terug localStorage.setItem(CUSTOMER_CACHE_KEY, JSON.stringify(customer)); } catch (e) {} } }); }); } // ------------------------------------------------------- link-decoratie function decorate(a) { try { var url = new URL(a.href, location.href); if (url.host === location.host) return; if (!/\.webshopapp\.com$/i.test(url.hostname) && !/lightspeed/i.test(url.hostname)) return; url.searchParams.set(LINK_PARAM, uuid); a.href = url.toString(); } catch (e) {} } function decorateAll() { var links = document.querySelectorAll("a[href]"); for (var i = 0; i < links.length; i++) decorate(links[i]); } function handleLinkEvent(event) { var a = event.target && event.target.closest ? event.target.closest("a[href]") : null; if (a) decorate(a); } // --------------------------------------------------------------- restore function restoreCart() { // herstel-link uit de mail: producten ophalen en client-side terug in de Lightspeed-cart zetten stripParam(RESTORE_PARAM); if (sessionStorage.getItem("nextmessage_restore_done") === uuid) return Promise.resolve(); sessionStorage.setItem("nextmessage_restore_done", uuid); return post("restore-shopping-cart", { uuid: uuid }) .then(function (r) { if (!r.ok) throw new Error("restore-shopping-cart status " + r.status); return r.json(); }) .then(function (data) { var products = (data && data.products) || []; var additions = []; products.forEach(function (p) { var variantId = p.sku || p.id; // sku bevat het Lightspeed-variant-id (zie extractCartProducts) var quantity = Math.min(Number(p.quantity) || 1, 25); for (var i = 0; i < quantity; i++) additions.push(variantId); }); var chain = Promise.resolve(); additions.forEach(function (variantId) { chain = chain.then(function () { return fetch("/cart/add/" + variantId + "/?format=json", { credentials: "same-origin" }).catch(function () {}); }); }); return chain; }) .then(function () { location.replace("/cart/"); }) .catch(function (e) { debug("herstel faalde", e); }); } // ------------------------------------------------------------------ init document.addEventListener("mousedown", handleLinkEvent, true); document.addEventListener("touchstart", handleLinkEvent, true); document.addEventListener("click", handleLinkEvent, true); function init() { if (restoreUuid) { registered.then(restoreCart); return; // geen cart-sync dwars door de herstel-actie heen } decorateAll(); syncCart(); if (isCheckoutPage()) { pollCheckoutFields(); setInterval(pollCheckoutFields, 5000); // zelfde interval als de WooCommerce-plugin } } if (document.readyState === "loading") { document.addEventListener("DOMContentLoaded", init); } else { init(); } })();
    Wij slaan cookies op om onze website te verbeteren. Is dat akkoord? JaNeeMeer over cookies »