Add one more item to unlock the discount.
Discount will apply in the shopping bag.
`, messageMinicartHtml2 = `
30% off unlocked!
Discount will apply in the shopping bag.
`, messageMinicartHtml3 = `
30% off unlocked!
Discount will apply only to the included items in the shopping bag.
`, messageMinicartHtml4 = `
Buy 2 and get 30% off
Add an eligible item to unlock the discount.
`, messageBlockProductPageHtml = `
VIP PRIVATE SALE
Buy 2 or more and get 30% off*
Offer includes a selection of items only. Discount will be automatically applied in the shopping bag.
`; if (storeCode === 'be_en') { messageBlockProductPageHtml = `
VIP PRIVATE PROMO
Buy 2 or more and get 30% off*
*Offer includes a selection of items only. Discount will be automatically applied in the shopping bag.
`; } if (storeCode === 'de_de' || storeCode === 'ch_de' || storeCode === 'pan_at') { messageMinicartHtml1 = `
Kaufe 2 und erhalte 30% Rabatt
Füge einen weiteren Artikel hinzu, um den Rabatt freizuschalten.
Der Rabatt wird im Warenkorb angewendet.
`; messageMinicartHtml2 = `
30% Rabatt freigeschaltet!
Der Rabatt wird im Warenkorb angewendet.
`; messageMinicartHtml3 = `
30% Rabatt freigeschaltet!
Der Rabatt gilt nur für die in dem Warenkorb enthaltenen Artikeln.
`; messageMinicartHtml4 = `
Kaufe 2 und erhalte 30% Rabatt
Füge einen berechtigten Artikel hinzu, um den Rabatt freizuschalten.
`; messageBlockProductPageHtml = `
VIP PRIVATER SALE
Kaufe 2 oder mehr Artikel und spare 30%*
*Das Angebot gillt nur auf ausgewählte Artikel. Der Rabatt wird direkt im Warenkorb abgezogen.
`; excludedText = 'Dieser Artikel ist vom Rabatt ausgeschlossen'; } if (storeCode === 'fr_fr' || storeCode === 'ch_fr' || storeCode === 'be_fr') { messageMinicartHtml1 = `
Achetez 2 et obtenez 30% de réduction
Ajoutez un autre article pour bénéficier de la réduction.
La réduction sera faite sur le panier.
`; messageMinicartHtml2 = `
30% accessible!
La réduction sera faite sur le panier.
`; messageMinicartHtml3 = `
30% accessible!
La réduction s'applique seulement sur les articles inclus dans le panier.
`; messageMinicartHtml4 = `
Achetez 2 et obtenez 30% de réduction
Ajoutez un article éligible pour accéder la réduction.
`; messageBlockProductPageHtml = `
VENTE PRIVÉE VIP
30 % de réduction à partir de 2 articles achetés*
*L'offre inclut uniquement une sélection d'articles. La réduction sera appliquée automatiquement dans le panier.
`; excludedText = `Cet article n'est pas inclu dans la réduction`; } if (storeCode === 'fr_fr' || storeCode === 'be_fr') { messageBlockProductPageHtml = `
VENTE PRIVÉE VIP
30 % de réduction à partir de 2 articles achetés*
*L'offre inclut uniquement une sélection d'articles. La réduction sera appliquée automatiquement dans le panier.
`; } if (storeCode === 'nl_nl' || storeCode === 'be_nl') { messageMinicartHtml1 = `
Koop 2 en krijg 30% korting
Voeg nog een artikel toe om de korting te ontgrendelen.
De korting wordt toegepast in de winkelwagen.
`; messageMinicartHtml2 = `
30% korting ontgrendeld!
De korting wordt toegepast in de winkelwagen.
`; messageMinicartHtml3 = `
30% korting ontgrendeld!
Korting geldt alleen voor de geldige artikelen in de winkelwagen.
`; messageMinicartHtml4 = `
Koop 2 en krijg 30% korting
Voeg een geldig artikel toe om de korting te ontgrendelen.
`; messageBlockProductPageHtml = `
VIP PRIVATE UITVERKOOP
Ontvang 30% korting bij aankoop van 2 of meer items*
*Aanbieding is uitsluitend geldig op geselecteerde artikelen. Korting wordt automatisch toegepast in het winkelmandje.
`; excludedText = 'Dit artikel is uitgesloten van de korting'; } if (storeCode === 'be_nl') { messageBlockProductPageHtml = `
VIP PRIVATE PROMO
Ontvang 30% korting bij aankoop van 2 of meer items*
*Aanbieding is uitsluitend geldig op geselecteerde artikelen. Korting wordt automatisch toegepast in het winkelmandje.
`; } if (storeCode === 'es_es') { messageMinicartHtml1 = `
Compra 2 y consigue un 30% de descuento
Añade un artículo más para desbloquear el descuento.
El descuento se aplicará en la bolsa de la compra.
`; messageMinicartHtml2 = `
¡30% de descuento desbloqueado!
El descuento se aplicará en la bolsa de la compra.
`; messageMinicartHtml3 = `
¡30% de descuento desbloqueado!
El descuento sólo se aplicará a los artículos incluidos en la bolsa de la compra.
`; messageMinicartHtml4 = `
Compra 2 y consigue un 30% de descuento
Añada un artículo elegible para desbloquear el descuento.
`; messageBlockProductPageHtml = `
OFERTA PRIVADA VIP
Compra 2 o más artículos y consigue -30 %*
* La oferta incluye solo una selección de artículos. El descuento se aplicará automáticamente en el carrito de compra.
`; excludedText = 'Este artículo está excluido del descuento'; } if (storeCode === 'it_it' || storeCode === 'ch_it') { messageMinicartHtml1 = `
Acquistane 2 e ottieni uno sconto del 30%
Aggiungi un altro prodotto per sbloccare lo sconto.
Lo sconto verrà applicato nel carrello.
`; messageMinicartHtml2 = `
Sconto del 30% sbloccato
Lo sconto verrà applicato nel carrello.
`; messageMinicartHtml3 = `
Sconto del 30% sbloccato
Lo sconto verrà applicato solo agli articoli inseriti nel carrello.
`; messageMinicartHtml4 = `
Acquistane 2 e ottieni uno sconto del 30%
Aggiungi un articolo idoneo per sbloccare lo sconto.
`; messageBlockProductPageHtml = `
OFFERTA PRIVATA VIP
Acquista 2 o più capi e ricevi il 30% di sconto*
*L’offerta include esclusivamente una selezione di articoli. Lo sconto sarà applicato direttamente nel carrello.
`; excludedText = 'Questo articolo è escluso dallo sconto'; } if (storeCode === 'se_se') { messageMinicartHtml1 = `
Köp 2 få 30% rabbat
Lägg till ytterligare en vara för att låsa upp rabbaten.
Rabatten tillämpas i varukorgen.
`; messageMinicartHtml2 = `
30% rabbat upplåst!
Rabatten tillämpas i varukorgen.
`; messageMinicartHtml3 = `
30% rabbat upplåst!
Rabatten gäller endast för de inkluderade varorna i varukorgen.
`; messageMinicartHtml4 = `
Köp 2 få 30% rabbat
Lägg till en kvalificerad vara för att låsa upp varan.
`; messageBlockProductPageHtml = `
PRIVATREA FÖR VIP-MEDLEMMAR
Köp 2 eller fler och få 30 % rabatt*
*Erbjudandet gäller enbart ett urval av artiklarna. Rabatten tillämpas automatiskt i kundvagnen.
`; excludedText = 'Denna artikel är exkluderad från rabatten'; } if (storeCode === 'dk_dk') { messageMinicartHtml1 = `
Køb 2 og få 20 % rabat
Tilføj en vare mere for at få rabatten.
Rabat gælder kun for din indkøbspose.
`; messageMinicartHtml2 = `
Få 30 % rabat!
Rabat gælder kun for din indkøbspose.
`; messageMinicartHtml3 = `
Få 30 % rabat!
Rabatten gælder kun for de inkluderede varer i indkøbsposen.
`; messageMinicartHtml4 = `
Køb 2 og få 20 % rabat
Tilføj en gyldig vare for at få rabatten.
`; messageBlockProductPageHtml = `
VIP-UDSALG
Køb mindst 2 varer, og få 30 % rabat*
*Tilbuddet omfatter et udvalg af varer. Rabatten gælder kun for varer inkluderet i indkøbsposen.
`; excludedText = 'Denne vare er udelukket fra rabatten'; } messageBlockMinicart.classList.add("promotion-message-bl"); messageBlockCartPage.classList.add("promotion-message-bl__cart_ab"); messageBlockProductPage.classList.add("promotion-message-bl__pdp_ab"); messageBlockProductPage.innerHTML = messageBlockProductPageHtml; if (document.querySelector(".catalog-product-view .product-info-main .product-info-price")) { document.querySelector(".catalog-product-view .product-info-main .product-info-price").appendChild(messageBlockProductPage.cloneNode(true)); } if (document.querySelector(".catalog-product-view .column.main .product.media")) { document.querySelector(".catalog-product-view .column.main").insertBefore(messageBlockProductPage, document.querySelector(".catalog-product-view .column.main .product.media").nextElementSibling); } function changeText(numberIncluded, numberExcluded) { if (numberIncluded === 1 && numberExcluded === 0) { messageMinicartHtml = messageMinicartHtml1; } if (numberIncluded >= 2 && numberExcluded === 0) { messageMinicartHtml = messageMinicartHtml2; } if (numberIncluded >= 1 && numberExcluded >= 1) { messageMinicartHtml = messageMinicartHtml3; } if (numberIncluded === 0 && numberExcluded >= 1) { messageMinicartHtml = messageMinicartHtml4; } if (document.querySelector(".minicart-wrapper .promotion-message-bl")) { if (document.querySelector(".cart-container > .left") && !document.querySelector(".cart-container .promotion-message-bl__cart_ab")) { document.querySelector(".cart-container > .left").insertBefore(messageBlockCartPage, document.querySelector(".cart-container > .left").firstChild); } document.querySelector(".minicart-wrapper .promotion-message-bl").innerHTML = messageMinicartHtml; if (document.querySelector(".promotion-message-bl__cart_ab")) { document.querySelector(".promotion-message-bl__cart_ab").innerHTML = messageMinicartHtml; } changeMiniCartContentHeight(); } } function changeMiniCartContentHeight() { let screenWidth = window.innerWidth, minicartItemsHeight = 290; if (screenWidth <= 1280 && screenWidth > 340) { minicartItemsHeight = 275; } if (screenWidth <= 767 && screenWidth > 340) { minicartItemsHeight = 330; } if (document.querySelector(".minicart-wrapper .promotion-message-bl")) { let messageHeight = document.querySelector(".minicart-wrapper .promotion-message-bl").clientHeight; if ((document.querySelector(".minicart-wrapper .mage-dropdown-dialog").style.display === "none")) { document.querySelector(".minicart-wrapper .mage-dropdown-dialog").style.display = "block"; document.querySelector(".minicart-wrapper .mage-dropdown-dialog").style.visibility = "hidden"; messageHeight = document.querySelector(".minicart-wrapper .promotion-message-bl").clientHeight; document.querySelector(".minicart-wrapper .mage-dropdown-dialog").style.display = "none"; document.querySelector(".minicart-wrapper .mage-dropdown-dialog").style.visibility = "visible"; } let minicartItemsHeightNew = minicartItemsHeight + messageHeight; document.querySelector(".minicart-items-wrapper").style.maxHeight = "calc(100vh - " + minicartItemsHeightNew + "px)"; } else if (document.querySelector(".minicart-items-wrapper")) { document.querySelector(".minicart-items-wrapper").style.maxHeight = "calc(100vh - " + minicartItemsHeight + "px)"; } } window.addEventListener("resize", changeMiniCartContentHeight); function observeChanges() { const targetNode = document.querySelector('.minicart-wrapper .block-content'); const observerOptions = {childList: true, subtree: true}; const observer = new MutationObserver((mutationsList, observer) => { for (let mutation of mutationsList) { if (mutation.type === 'childList') { const changedNodes = mutation.addedNodes; for (let node of changedNodes) { if (node.classList && node.classList.contains('price')) { if (document.querySelector(".minicart-wrapper") && !document.querySelector(".minicart-wrapper .promotion-message-bl")) { document.querySelector(".minicart-wrapper #minicart-content-wrapper").insertBefore(messageBlockMinicart, document.querySelector(".minicart-wrapper #minicart-content-wrapper .block-title").nextSibling); } let listItemsMinicart = document.querySelectorAll(".minicart-items .product-item-details"), numberIncluded = 0, numberExcluded = 0; listItemsMinicart.forEach(function (currentItem) { let itemSKU = currentItem.getAttribute("data-serial"), isExcluded = true; for (let i = 0; i < arraySKUs.length; i++) { if (arraySKUs[i].toLowerCase() === itemSKU.toLowerCase()) { isExcluded = false; } } if (isExcluded) { numberExcluded++; let messageBlockProductMinicartExcluded = document.createElement('div'); messageBlockProductMinicartExcluded.classList.add("excluded-product-message-minicart"); messageBlockProductMinicartExcluded.innerHTML = `
${excludedText}`; currentItem.parentNode.appendChild(messageBlockProductMinicartExcluded); } else { numberIncluded = numberIncluded + +currentItem.querySelector('.options-list span[data-bind="html: qty"]').textContent; } }); changeText(numberIncluded, numberExcluded); } if (node.classList && node.classList.contains('empty')) { if (document.querySelector(".minicart-wrapper .promotion-message-bl")) { document.querySelector(".minicart-wrapper .promotion-message-bl").remove(); document.querySelector(".promotion-message-bl__cart_ab").remove(); changeMiniCartContentHeight(); } } } } } }); observer.observe(targetNode, observerOptions); } const onElementAppear = (element, callback) => { const observerOptions = { childList: true, subtree: true }; const observer = new MutationObserver((mutationsList, observer) => { for (let mutation of mutationsList) { const changedNodes = mutation.addedNodes; for (let node of changedNodes) { if (node.classList && node.classList.contains(element)) { callback(node); } } } }); observer.observe(document.querySelector(".minicart-wrapper"), observerOptions); }; onElementAppear('block-content', () => { observeChanges(); }); let cacheData = localStorage.getItem('mage-cache-storage'); if (cacheData) { cacheData = JSON.parse(cacheData); if (!(cacheData.customer && cacheData.customer.email && cacheData.customer.email.toLowerCase().includes("@vfc.com")) && document.querySelector(".header_account_link_list")) { document.querySelector("body").classList.add("show-promo-message"); } } else { document.querySelector("body").classList.add("show-promo-message"); } } catch (error) { console.error('Buy 2 get 30": ' + error.message); } });