Womens Activewear – Shaping & Flattering Workout Clothes | SPANX – Spanx [[# helpers.fullHTMLTitle ]][[/ helpers.fullHTMLTitle ]]

[[# product_type ]] [[& _highlightResult.product_type.value ]] [[/ product_type ]] [[# vendor ]] [[# helpers.by ]] [[& _highlightResult.vendor.value ]] [[/ helpers.by ]] [[/ vendor ]]

[[# helpers.autocompletePrice ]][[/ helpers.autocompletePrice ]] ]]>

[[# helpers.no_result_for ]] “[[ query ]]” [[/ helpers.no_result_for]]

[[ translations.allProducts ]] ]]>

[[# multipleSortOrders ]] [[ translations.sortBy ]] [[/ multipleSortOrders ]] [[^ multipleSortOrders ]] [[ translations.sortBy ]] [[ translations.relevance ]] [[/ multipleSortOrders ]] ]]> div { display: table-cell; vertical-align: middle; margin-top: -0.15em; margin-bottom: -0.15em; padding: 4px 6px; background: #f4f4f4; width: 100%; max-width: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; } .ais-page .ais-CurrentRefinements-label:hover { text-decoration: none; } .ais-page .ais-CurrentRefinements-label:hover > div { text-decoration: line-through; } .ais-page .ais-CurrentRefinements-label { font-weight: bold; } .ais-RangeSlider .rheostat-tooltip { display: none; background: transparent; position: absolute; font-size: 0.8em; transform: translate(-50%, -100%); left: 50%; line-height: 1.5em; text-align: center; } .ais-page .ais-current-refined-values–link { display: table; width: 100%; margin: 4px 0; border: 1px solid #e0e0e0; cursor: pointer; } .ais-page .ais-current-refined-values–link:hover { text-decoration: none; } .ais-page .ais-current-refined-values–link:before { content: ‘2a2f’; display: table-cell; vertical-align: middle; width: 0; padding: 4px 6px; background: #e0e0e0; } .ais-page .ais-current-refined-values–link div { display: inline; } .ais-page .ais-current-refined-values–link > div { display: table-cell; vertical-align: middle; margin-top: -0.15em; margin-bottom: -0.15em; padding: 4px 6px; background: #f4f4f4; width: 100%; max-width: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; } .ais-page .ais-current-refined-values–link:hover > div { text-decoration: line-through; } .ais-page .ais-current-refined-values–label { font-weight: bold; } .ais-RangeSlider .rheostat-handle:hover .rheostat-tooltip { display: block; } .ais-RangeSlider .rheostat-handle { background: #fff; border-radius: 50%; cursor: grab; height: 20px; outline: none; transform: translate(-50%, calc(-50% + -3px)); border: 1px solid #ccc; width: 20px; z-index: 1; } .ais-RangeSlider .rheostat-value { padding-top: 15px; font-size: 0.8em; transform: translateX(-50%); position: absolute; } .ais-RangeSlider .rheostat-horizontal { cursor: pointer; margin: 16px 16px 24px; } .ais-RangeSlider .rheostat-background { background-color: rgba(65, 66, 71, 0.08); border: 1px solid #ddd; height: 6px; } .ais-RangeSlider .rheostat-progress { background-color: [[ colors.main ]]; cursor: pointer; height: 4px; top: 1px; position: absolute; } .ais-RangeSlider .rheostat-marker-horizontal { background: #ddd; width: 1px; height: 5px; pointer-events: none; } .ais-RangeSlider .rheostat-marker-large { background: #ddd; width: 2px; height: 12px; } /* Search box */ .ais-page .ais-input { display: table; width: 100%; border: 2px solid [[ colors.main ]]; } .ais-page .ais-input–label { display: table-cell; vertical-align: middle; width: 0; padding: 8px; padding-right: 24px; white-space: nowrap; color: white; background: [[ colors.main ]]; } .ais-results-size-xs .ais-page .ais-input–label { display: none; } .ais-page .ais-search-box-container { display: table-cell; width: 100%; vertical-align: middle; } .ais-page .ais-SearchBox-input { width: 100%; padding: 8px 16px 8px 4px; border: none; } .ais-page .ais-SearchBox-input::-ms-clear { display: none; width: 0; height: 0; } .ais-page .ais-SearchBox-input, .ais-page .ais-SearchBox-input:focus { outline: 0; box-shadow: none; height: 32px; padding: 0 8px; } .ais-page .ais-input-button { display: table-cell; vertical-align: middle; width: 0; padding: 4px 8px; } .ais-page .ais-clear-input-icon, .ais-page .ais-algolia-icon { background-size: contain; background-position: center center; background-repeat: no-repeat; cursor: pointer; } .ais-page .ais-clear-input-icon { display: none; width: 16px; height: 16px; background-image: url(‘data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIHZpZXdCb3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 .ais-page .ais-search-header { margin: 16px 0 8px 0; padding: 0.6em 0.9em 0.4em 0.9em; background: #f4f4f4; color: [[ colors.secondary ]]; } .ais-page .ais-search-header:after { content: ”; clear: both; display: block; } .ais-page .ais-search-header { font-size: 0.85em; } .ais-page .ais-search-header * { font-size: inherit; line-height: 1.6; } /* Stats */ .ais-page .ais-Stats { float: left; } .ais-page .ais-stats–nb-results { font-weight: bold; } .ais-results-size-xs .ais-page .ais-Stats { float: none; } /* Display mode */ .ais-page .ais-change-display { float: right; margin-left: 10px; cursor: pointer; } .ais-page .ais-change-display-block:hover, .ais-page .ais-change-display-list:hover, .ais-page .ais-change-display-selected { color: [[ colors.main ]]; } /* Sort orders */ .ais-page .ais-sort { float: right; } .ais-results-size-xs .ais-page .ais-sort { float: none; } .ais-page .ais-SortBy { display: inline-block; } .ais-page .ais-SortBy-select { height: 1.6em; padding: 0px 30px 0px 5px; margin-top: -0.1em; } /* Hits */ .ais-page .ais-Hits:after { content: ”; clear: both; display: block; } .ais-page .ais-hit-empty { margin-top: 60px; text-align: center; } .ais-page .ais-highlight { position: relative; z-index: 1; font-weight: bold; } .ais-page .ais-highlight:before { content: ”; position: absolute; z-index: -1; width: 100%; height: 100%; background: [[ colors.main ]]; opacity: 0.1; } .ais-page .ais-hit { position: relative; float: left; margin: 8px 0 16px 0; border: 1px solid #e0e0e0; cursor: pointer; } .ais-page .ais-hit:hover { border-color: [[ colors.main ]]; } .ais-page .ais-hit–details > * { width: 100%; margin-top: -0.15em; margin-bottom: -0.15em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; } .ais-page .ais-hit–title { color: [[ colors.main ]]; } .ais-page .ais-hit–subtitle { font-size: 0.9em; color: [[ colors.secondary ]]; } .ais-page .ais-hit–subtitle * { font-size: inherit; } .ais-page .ais-hit–price { color: [[ colors.main ]]; } .ais-page .ais-hit–price-striked { text-decoration: line-through; color: [[ colors.secondary ]]; } .ais-page .ais-hit–price-striked span { color: [[ colors.main ]]; } .ais-page .ais-hit–price-discount { color: [[ colors.secondary ]]; } .ais-page .ais-hit–cart-button { display: inline-block; width: auto; padding: 8px 16px; margin-top: 8px; color: [[ colors.secondary ]]; background: #e0e0e0; font-size: 0.9em; text-transform: uppercase; } .ais-page .ais-hit–cart-button:not(.ais-hit–cart-button__disabled):hover { background-color: [[ colors.main ]]; color: white; text-decoration: none; } .ais-page .ais-hit–cart-button__disabled { background: #ccc; } .ais-page .ais-results-as-list .ais-hit { padding: 30px 25px; /* $v_padding $h_padding */ width: 100%; min-height: 170px; /* $img_size + 2 * $v_padding */ } .ais-page .ais-results-as-list .ais-hit–picture { position: absolute; top: 30px; /* $v_padding */ left: 25px; /* $h_padding */ width: 110px; /* $img_size */ height: 110px; /* $img_size */ background-position: center center; background-size: contain; background-repeat: no-repeat; } .ais-page .ais-results-as-list .ais-hit–details { margin-left: 160px; /* $img_size + 2 * $h_padding */ } .ais-page .ais-results-as-block .ais-hit { padding: 30px 25px; /* $v_padding $h_padding */ text-align: center; } .ais-results-size-xs .ais-page .ais-results-as-block .ais-hit { width: 98%; margin-left: 2%; } .ais-results-size-sm .ais-page .ais-results-as-block .ais-hit, .ais-results-size-md .ais-page .ais-results-as-block .ais-hit { width: 47.5%; margin-left: 5%; } .ais-results-size-sm .ais-page .ais-results-as-block .ais-Hits-item:nth-of-type(2n + 1) .ais-hit, .ais-results-size-md .ais-page .ais-results-as-block .ais-Hits-item:nth-of-type(2n + 1) .ais-hit { margin-left: 0; } .ais-results-size-lg .ais-page .ais-results-as-block .ais-hit { width: 30%; margin-left: 5%; } .ais-results-size-lg .ais-page .ais-results-as-block .ais-Hits-item:nth-of-type(3n + 1) .ais-hit { margin-left: 0; } .ais-page .ais-results-as-block .ais-hit–picture { position: absolute; top: 30px; /* $v_padding */ left: 50%; margin-left: -55px; /* -$img_size / 2 */ width: 110px; /* $img_size */ height: 110px; /* $img_size */ background-position: center center; background-size: contain; background-repeat: no-repeat; } .ais-page .ais-results-as-block .ais-hit–details { margin-top: 140px; /* $img_size + $v_padding */ } /* Pagination */ .ais-page .ais-Pagination-list { text-align: center; } .ais-page .ais-Pagination-item { display: inline-block; width: 32px; height: 32px; margin: 0px 5px; border: 1px solid #e0e0e0; border-radius: 2px; text-align: center; } .ais-page .ais-Pagination–active { border-color: [[ colors.main ]]; } .ais-page .ais-Pagination-item–disabled { visibility: hidden; } .ais-page .ais-Pagination-link { display: inline-block; width: 100%; height: 100%; padding: 5px 0; font-size: 0.9em; color: [[ colors.main ]]; } ]]> [[# helpers.fullEscapedHTMLTitle ]][[/ helpers.fullEscapedHTMLTitle ]]

[[# helpers.fullEscapedHTMLProductType ]][[/ helpers.fullEscapedHTMLProductType ]] [[# vendor ]] by [[# helpers.fullEscapedHTMLVendor ]][[/ helpers.fullEscapedHTMLVendor ]][[/ vendor ]]

[[# helpers.instantsearchPrice ]][[/ helpers.instantsearchPrice ]]

[[# sku ]] [[& _highlightResult.sku.value ]] [[/ sku ]] [[# barcode ]] [[& _highlightResult.barcode.value ]] [[/ barcode ]] [[# weight ]] [[ weight ]] [[/ weight ]] [[^ taxable ]] Tax free [[/ taxable ]]

[[# _highlightResult.tags ]] [[& value ]] [[/ _highlightResult.tags ]] [[^ _distinct ]]

[[# can_order ]] [[ translations.addToCart ]] [[/ can_order ]] [[^ can_order ]] [[ translations.outOfStock ]] [[/ can_order ]] [[/ _distinct ]] ]]>

= 0; })) { // There’s at least one return true; } return false }; const ALGOLIA_ID = isCanada() ? “LD515O4VDO” : “WQD8KYMS9K”; const ALGOLIA_KEY = isCanada() ? “90df238c93b11c4cff81a5a9a89e8e31” : “687b22f1fc501ef1533c9f0af690bcff”; aa(“init”, { appId: ALGOLIA_ID, apiKey: ALGOLIA_KEY });]]> { return window.location.pathname.split(“/”)[1] === “fr”; }; ]]> { window.i18nHelpers.functions.checkLanguageCookie = name => { let languageInCookie = null; const cookieDecoded = decodeURIComponent(document.cookie); const cookieArray = cookieDecoded.split(“; “); cookieArray.forEach(cookie => { if (cookie.indexOf(name) === 0) { languageInCookie = cookie.substring(name.length + 1); } }); return languageInCookie; }; window.i18nHelpers.functions.setLanguageCookie = (name, value, daysToLive) => { const date = new Date(); date.setTime(date.getTime() + daysToLive * 24 * 60 * 60 * 1000); let expires = “expires=”; expires = expires.concat(date.toUTCString()); document.cookie = `${name}=${value}; ${expires}; path=/`; }; window.i18nHelpers.functions.checkSiteLanguage = () => { const {setLanguageCookie} = window.i18nHelpers.functions; if (isFrenchURL()) { setLanguageCookie(“langPref”, “fr_ca”, 30); } else { setLanguageCookie(“langPref”, “en”, 30); } }; window.i18nHelpers.functions.checkSiteLanguage(); })(window); ]]>

{ const caStoreURLS = [ “spanx.ca”, “spanx-ca-dev.myshopify.com”, “spanx-ca-com.myshopify.com” ]; const defaultLanguageCode = “en”; const supportedLocales = { US: [“en”], CA: [“en”, “fr”] }; const checkoutLocalizationParamName = “locale”; // Shopify’s const isCanadaStore = () => { const windowLocation = window.location.href; // check if window location includes a substring from string array if (caStoreURLS.some(v => windowLocation.indexOf(v) > -1)) return true; return false; }; const getCurrentCountryCode = () => { return isCanadaStore() ? “CA” : “US”; };const isLanguageSupported = langCode => { if (langCode === “”) return false; const supportedLanguages = isCanadaStore() ? supportedLocales.CA : supportedLocales.US; return supportedLanguages.includes(langCode); };const getCurrentLanguageCodeFromURLFolder = () => { try { const currentPathParts = (window.location.pathname.split(“/”) || []).filter( part => part.trim() !== “” ); const folder = currentPathParts.length ? currentPathParts[0].trim().toLowerCase() : “”; return isLanguageSupported(folder) ? folder : false; } catch (err) { return false; } };const getCurrentLanguageCodeFromCookies = () => { try { const transperfectCookieName = “langPref”; const customCookieName = “lang”; const separator = “_”; const langCookie = document.cookie.match(`(^|;)\s*${transperfectCookieName}\s*=\s*([^;]+)`) || document.cookie.match(`(^|;)\s*${customCookieName}\s*=\s*([^;]+)`) || null; if (langCookie) { const langCookieVal = (langCookie.pop() || “”).trim().toLowerCase() || “”; const langCode = langCookieVal.includes(separator) ? langCookieVal.split(separator).shift() : langCookieVal; return isLanguageSupported(langCode) ? langCode : false; } return false; } catch (err) { return false; } };const getCurrentLanguageCodeFromLocale = () => { try { const separator = “-“; const checkoutLocale = window.Shopify?.Checkout?.locale || null; if (checkoutLocale) { const checkoutLocaleVal = checkoutLocale.trim().toLowerCase() || “”; const langCode = checkoutLocaleVal.includes(separator) ? checkoutLocaleVal.split(separator).shift() : checkoutLocaleVal; return isLanguageSupported(langCode) ? langCode : false; } return false; } catch (err) { return false; } };window.i18nHelpers = window.i18nHelpers || { settings: {}, functions: {} };window.i18nHelpers.settings = { enableQuebec: true, quebecLocalizeCheckoutURL: false, quebecLocalizeCheckoutModule: false };window.i18nHelpers.functions.getDefaultLanguageCode = function() { return defaultLanguageCode; }; window.i18nHelpers.functions.getShopifyLocalizationParamName = function() { return checkoutLocalizationParamName; }; window.i18nHelpers.functions.getCurrentCurrency = function() { return isCanadaStore() ? “CAD” : “USD”; }; window.i18nHelpers.functions.isCanada = function() { return isCanadaStore(); };window.i18nHelpers.functions.isQuebecEnabled = function() { const { enableQuebec } = window.i18nHelpers.settings; return isCanadaStore() && enableQuebec; };window.i18nHelpers.functions.isQuebecLocalizedCheckoutEnabled = function() { const { isQuebecEnabled } = window.i18nHelpers.functions; const { quebecLocalizeCheckoutURL, quebecLocalizeCheckoutModule } = window.i18nHelpers.settings; return isQuebecEnabled() && (quebecLocalizeCheckoutModule || quebecLocalizeCheckoutURL); };window.i18nHelpers.functions.isQuebecCheckoutModuleLocalizationEnabled = function() { const { isQuebecLocalizedCheckoutEnabled } = window.i18nHelpers.functions; const { quebecLocalizeCheckoutModule } = window.i18nHelpers.settings; return isQuebecLocalizedCheckoutEnabled() && quebecLocalizeCheckoutModule; };window.i18nHelpers.functions.parseLanguageTag = function(languageTag) { if (!languageTag) return false; const tagSeparator = “_”; let parsedLanguageTag = { countryCode: false, languageCode: false, languageTag: false }; switch (languageTag.trim().length) { // ISO639-1 (2 letter language code) case 2: { const languageCode = languageTag.trim().toLowerCase(); const currentCountryCode = getCurrentCountryCode(); let supportedCountries = []; Object.keys(supportedLocales).forEach(country => { if (supportedLocales[country].includes(languageCode)) { supportedCountries.push(country); }; }); if (!supportedCountries.length) break; if (!supportedCountries.includes(currentCountryCode)) break; parsedLanguageTag = { countryCode: currentCountryCode, languageCode, languageTag: `${languageCode}_${currentCountryCode}` }; break; } // ISO639-1 (2 letter language code) + SEPARATOR + ISO3166-1 (2 letter country code) case 5: { if (!languageTag.contains(tagSeparator)) break; const [languageCode, countryCode] = languageTag .split(tagSeparator) .map((code, i) => { return (i === 0 ? code.toLowerCase() : code.toUpperCase()).trim(); }); if (!Object.keys(supportedLocales).includes(countryCode)) break; if (!supportedLocales[countryCode].contains(languageCode)) break; parsedLanguageTag = { countryCode, languageCode, languageTag: `${languageCode}_${countryCode}` }; break; } // unknown/unexpected language tag format default: { return false; } } return Object.keys(parsedLanguageTag).some( key => parsedLanguageTag[key] === false ) ? false : parsedLanguageTag; };window.i18nHelpers.functions.getUserLocalePreference = function() { const { parseLanguageTag } = window.i18nHelpers.functions; const { isQuebecEnabled } = window.i18nHelpers.functions; let userPreference = defaultLanguageCode; if (isQuebecEnabled()) {userPreference = getCurrentLanguageCodeFromURLFolder() || getCurrentLanguageCodeFromCookies(); } return parseLanguageTag(userPreference ? userPreference : defaultLanguageCode); };window.i18nHelpers.functions.getUserLanguageCodePreference = function() { const { getUserLocalePreference } = window.i18nHelpers.functions; const localePref = getUserLocalePreference(); return localePref.languageCode ? localePref.languageCode : false; };window.i18nHelpers.functions.getUserLanguageOnCheckout = function() { const { parseLanguageTag } = window.i18nHelpers.functions; const { isQuebecEnabled } = window.i18nHelpers.functions; const { getUserLocalePreference } = window.i18nHelpers.functions; let userPreference = defaultLanguageCode; if (isQuebecEnabled()) {userPreference = getCurrentLanguageCodeFromCookies() || getCurrentLanguageCodeFromLocale(); } const localePref = parseLanguageTag(userPreference ? userPreference : defaultLanguageCode); return localePref.languageCode ? localePref.languageCode : false; };window.i18nHelpers.functions.getCurrencyFormat = function(languageCode) { switch (languageCode.trim().toLowerCase()) { case “fr”: { return { decimalSeparator: “,”, symbol: “$”, trailingSymbol: true }; } default: { return { decimalSeparator: “.”, symbol: “$”, trailingSymbol: false }; } } }; })(window); ]]> { var arr = item.href.split(‘/products/’); var handle = arr[arr.length – 1].split(‘?’)[0]; var matchingProduct = collectionProducts.filter(product => { return product.handle === handle; }); if (matchingProduct.length) { if (!visibleProducts.includes(matchingProduct[0])) { visibleProducts.push(matchingProduct[0]); // add click handler for the item item.addEventListener(‘click’, (e) => { handleProductClick(e, matchingProduct[0]) }); } } }); window.dataLayer.push({ “event”: “collection_impressions”, “ecommerce”: { “currencyCode”: “USD”, “actionField”: { “list”: formatHandle(collection.handle) }, “impressions”: visibleProducts, } }); var lastIndex = visibleProducts.length – 1; if (lastIndex) { lastSentIndex = collectionProducts.findIndex(collectionProduct => collectionProduct.handle === visibleProducts[lastIndex].handle) } } } function getClickedProductHandle(element) { var arr = element.href.split(‘/products/’); return arr[arr.length-1]; } function handleProductClick(event, clickedProduct) { if (clickedProduct) delete clickedProduct.list; if (clickedProduct) delete clickedProduct.handle; window.dataLayer.push({ “event”: “product_click”, “ecommerce”: { currencyCode: “USD”, “click”: { “actionField”: { “list”: formatHandle(collection.handle) }, “products”: [clickedProduct] } }, }); } /* Observe for “Load More” button */ var observer = new MutationObserver(function (mutations, obs) { var loadMoreBtn = document.getElementsByClassName(‘collection-grid__load-more-button’), // wait for all the collection products to load before sending collection impressions paginationMsg = document.getElementsByClassName(‘collection-grid__pagination-message’); if (paginationMsg.length > 0 && paginationMsg[0].innerHTML.length > 0) { sendCollectionImpressions(); if (loadMoreBtn.length > 0) { loadMoreBtn[0].addEventListener(‘click’, handleLoadMoreBtnClick) } obs.disconnect(); return; } }); observer.observe(document, { childList: true, subtree: true, attributes: true, attributeFilter: [‘class’] }); /* When “Load More” is pressed */ async function handleLoadMoreBtnClick(event) { currentPage++; // if loaded products are missing newer products that will load on UI, load next ajax page if (collectionProductsRaw.length – perPage res.json()); if (response.products && response.products.length) { collectionProductsRaw = Array.from( // using Set to remove duplicates new Set( collectionProductsRaw.concat(response.products) ) ); } } if (collectionProductsRaw.length) { // add those products to the datalayer with sendCollectionImpressions function buildCollectionProducts(collectionProductsRaw); sendCollectionImpressions(); } } function formatHandle(handle) { return handle.replace(/-/g, ‘ ‘).toLowerCase(); } ]]> -1 || url.indexOf(‘order’) > -1) { __bva__products = []; var transactionData = { ‘checkoutInfoHashed’ : { ’email’ : ‘e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855’, ‘fullName’ : ‘e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855’, ‘firstName’ : ‘e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855’, ‘lastName’ : ‘e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855’, ‘address1’ : ‘e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855’, ‘address2’ : ‘e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855’, ‘street’ : ‘e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855’, ‘city’ : ‘e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855’, ‘province’ : ‘e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855’, ‘zip’ : ‘e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855’, ‘country’ : ‘e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855’, ‘phone’ : ‘e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855’ }, ‘transactionNumber’ : null, ‘transactionId’ : null, ‘transactionAffiliation’ : “Spanx”, ‘transactionCurrency’ : “USD”, ‘transactionTotal’ : Number(), ‘transactionTax’ : Number(), ‘transactionShipping’ : Number(), ‘transactionSubtotal’ : Number(), ‘products’: __bva__products, }; if (url.indexOf(‘thank_you’) > -1) { baseEvent = transactionData; baseEvent.pageType = ‘Transaction’; baseEvent.event = ‘Transaction’; sessionStorage.removeItem(“productCategory”); } if (url.indexOf(‘order’) > -1) { baseEvent = transactionData; baseEvent.pageType = ‘Order Status’; baseEvent.event = ‘Order Status’; } } /* DATALAYER: Checkout */ /* DATALAYER: Template-Specific Events */ dataLayer.push(logState); dataLayer.push(baseEvent); /* DATALAYER: All Pages */ dataLayer.push({ ‘event’: ‘DataLayer Loaded’ }); }()); function fetchCategory(itemID, fallback) { const cartStorage = sessionStorage.getItem(“productCategory”); if (cartStorage) { const match = JSON.parse(cartStorage).find(storageItem => storageItem.id === itemID); return match && match.category ? match.category : fallback; } return fallback; } ]]>

Source

Leave a Reply

Your email address will not be published. Required fields are marked *