snusdaddy.com
Open in
urlscan Pro
172.66.43.78
Public Scan
URL:
https://snusdaddy.com/
Submission: On December 26 via manual from US — Scanned from IL
Submission: On December 26 via manual from US — Scanned from IL
Form analysis
69 forms found in the DOMGET https://snusdaddy.com/search/
<form class="form minisearch" id="search_mini_form" x-ref="form" action="https://snusdaddy.com/search/" method="get">
<label class="hidden" for="search" data-role="minisearch-label">
<span>Search</span>
</label>
<input id="search" x-ref="searchInput" type="search" autocomplete="off" name="q" value="" placeholder="Search entire store here..." maxlength="128" class="w-full p-2 text-lg leading-normal transition appearance-none text-grey-800
focus:outline-none focus:border-transparent lg:text-xl">
<template x-if="suggestions.length > 0">
<div class="w-full leading-normal transition appearance-none text-grey-800 flex flex-col mt-1">
<template x-for="suggestion in suggestions">
<div class="flex justify-between p-2 bg-container-lighter even:bg-container mb-1 cursor-pointer
border border-container hover:bg-container-darker" tabindex="0" @click="search(suggestion.title)" @keydown.enter="search(suggestion.title)" @keydown.arrow-up.prevent="
focusElement($event.target.previousElementSibling) || $refs.searchInput.focus()
" @keydown.arrow-down.prevent="focusElement($event.target.nextElementSibling)">
<span x-text="suggestion.title"></span>
<span x-text="suggestion.num_results"></span>
</div>
</template>
</div>
</template>
<button type="submit" title="Search" class="action search sr-only" aria-label="Search"> Search </button>
</form>
POST
<form class="form form-login" method="post" @submit.prevent="submitForm();" id="login-form">
<div class="control">
<input type="hidden" value="" name="g-recaptcha-response">
</div>
<div class="fieldset login">
<div class="field email required">
<label class="label" for="form-login-username" form="login-form">
<span>Email Address</span>
</label>
<div class="control">
<input name="username" id="form-login-username" x-ref="customer-email" @change="errors = 0" type="email" required="" autocomplete="off" class="form-input input-text">
</div>
</div>
<div class="field password required">
<label for="form-login-password" class="label" form="login-form">
<span>Password</span>
</label>
<div class="control">
<input name="password" id="form-login-password" type="password" class="form-input input-text" required="" x-ref="customer-password" autocomplete="off" @change="errors = 0">
</div>
</div>
<input name="context" type="hidden" value="checkout">
<div class="actions-toolbar flex justify-between pt-6 pb-2 items-center">
<button type="submit" class="inline-flex btn btn-primary disabled:opacity-75"> Sign In </button>
<a href="https://snusdaddy.com/customer/account/forgotpassword/">
Forgot Your Password? </a>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/1042/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/1042/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form1042">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="1042">
<a href="https://snusdaddy.com/zyn-slim-gentle-mint" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-1042.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/z/y/zyn_gentle_mint_460x460.png" loading="lazy" width="240" height="300" alt="ZYN Slim Gentle Mint Regular " title="ZYN Slim Gentle Mint Regular ">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> ZYN <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/zyn-slim-gentle-mint" :id="`slide-desc-1042-${$id('slider-id')}`" id="slide-desc-1042-slider-id-2">
Slim Gentle Mint Regular </a>
</div>
<div class="mg-per-pouch"> 6.6 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty1042 !== 'function') {
function updateQtyBasedOnTierPriceQty1042(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-1042');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[1042]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-1042');
const priceWods = document.getElementsByClassName('product-wod-price-1042');
const priceTotals = document.getElementsByClassName('sd-total-price-1042');
const pricePerCans = document.getElementsByClassName('product-price-1042');
let savePrice = 0;
let customTotalsPrice = 4.99;
var customPerItemPrice = 4.99;
if (qty >= 10) {
savePrice = qty * 0.5;
customTotalsPrice = parseFloat("4.49") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.49;
}
if (qty >= 30) {
savePrice = qty * 0.6;
customTotalsPrice = parseFloat("4.39") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.39;
}
if (qty >= 60) {
savePrice = qty * 0.7;
customTotalsPrice = parseFloat("4.29") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.29;
}
if (qty >= 100) {
savePrice = qty * 0.8;
customTotalsPrice = parseFloat("4.19") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.19;
}
// Calculate the price
const wodPrice = qty * 4.99;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.99);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.99)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-1042 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-1042" onclick="updateQtyBasedOnTierPriceQty1042(this, 1)">
<span>1 can</span>
<span><span class="price">$4.99</span></span>
<span>(<span class="price">$4.99</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-1042" onclick="updateQtyBasedOnTierPriceQty1042(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="44.9" data-price-type="" class="price-wrapper "><span class="price">$44.90</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="4.49" data-price-type="" class="price-wrapper "><span class="price">$4.49</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-1042" onclick="updateQtyBasedOnTierPriceQty1042(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="131.7" data-price-type="" class="price-wrapper "><span class="price">$131.70</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="4.39" data-price-type="" class="price-wrapper "><span class="price">$4.39</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-1042" onclick="updateQtyBasedOnTierPriceQty1042(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="257.4" data-price-type="" class="price-wrapper "><span class="price">$257.40</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="4.29" data-price-type="" class="price-wrapper "><span class="price">$4.29</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-1042" onclick="updateQtyBasedOnTierPriceQty1042(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="419" data-price-type="" class="price-wrapper "><span class="price">$419.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="4.19" data-price-type="" class="price-wrapper "><span class="price">$4.19</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-1042" onchange="updateQtyBasedOnTierPriceQty1042(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice1042() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.99,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "164263",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "1042",
"website_price": 4.49,
"price_incl_tax": 4.49,
"price_excl_tax": 4.49
}, {
"price_id": "164827",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "1042",
"website_price": 4.39,
"price_incl_tax": 4.39,
"price_excl_tax": 4.39
}, {
"price_id": "165391",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "1042",
"website_price": 4.29,
"price_incl_tax": 4.29,
"price_excl_tax": 4.29
}, {
"price_id": "165955",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "1042",
"website_price": 4.19,
"price_incl_tax": 4.19,
"price_excl_tax": 4.19
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-1042.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-1042.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice1042()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-1042" id="product-save-price-1042">
</span>
<span class="sd-price-without-discount-amount product-wod-price-1042" id="product-wod-price-1042">
</span>
<span class="price-label block"> </span>
<span id="product-price-1042" class="sd-unit-price product-price-1042">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.99</span> </span> / can </span>
<meta itemprop="price" content="4.99">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-1042" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-1042" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.99</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-1042" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-1042" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField1042 !== 'function') {
function initQtyField1042() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '1042',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField1042()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[1042]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[1042]" form="product_addtocart_form1042" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[1042] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-1042', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form1042" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/1027/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/1027/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form1027">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="1027">
<a href="https://snusdaddy.com/iceberg-cola" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-1027.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/i/c/iceberg_cola_460x460.png" loading="lazy" width="240" height="300" alt="Iceberg Cola" title="Iceberg Cola">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> Iceberg <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/iceberg-cola" :id="`slide-desc-1027-${$id('slider-id')}`" id="slide-desc-1027-slider-id-3">
Cola </a>
</div>
<div class="mg-per-pouch"> 35 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty1027 !== 'function') {
function updateQtyBasedOnTierPriceQty1027(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-1027');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[1027]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-1027');
const priceWods = document.getElementsByClassName('product-wod-price-1027');
const priceTotals = document.getElementsByClassName('sd-total-price-1027');
const pricePerCans = document.getElementsByClassName('product-price-1027');
let savePrice = 0;
let customTotalsPrice = 4.69;
var customPerItemPrice = 4.69;
if (qty >= 10) {
savePrice = qty * 0.47;
customTotalsPrice = parseFloat("4.22") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.22;
}
if (qty >= 30) {
savePrice = qty * 0.56;
customTotalsPrice = parseFloat("4.13") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.13;
}
if (qty >= 60) {
savePrice = qty * 0.66;
customTotalsPrice = parseFloat("4.03") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.03;
}
if (qty >= 100) {
savePrice = qty * 0.75;
customTotalsPrice = parseFloat("3.94") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.94;
}
// Calculate the price
const wodPrice = qty * 4.69;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.69);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.69)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-1027 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-1027" onclick="updateQtyBasedOnTierPriceQty1027(this, 1)">
<span>1 can</span>
<span><span class="price">$4.69</span></span>
<span>(<span class="price">$4.69</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-1027" onclick="updateQtyBasedOnTierPriceQty1027(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="42.2" data-price-type="" class="price-wrapper "><span class="price">$42.20</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="4.22" data-price-type="" class="price-wrapper "><span class="price">$4.22</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-1027" onclick="updateQtyBasedOnTierPriceQty1027(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="123.9" data-price-type="" class="price-wrapper "><span class="price">$123.90</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="4.13" data-price-type="" class="price-wrapper "><span class="price">$4.13</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-1027" onclick="updateQtyBasedOnTierPriceQty1027(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="241.8" data-price-type="" class="price-wrapper "><span class="price">$241.80</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="4.03" data-price-type="" class="price-wrapper "><span class="price">$4.03</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-1027" onclick="updateQtyBasedOnTierPriceQty1027(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="394" data-price-type="" class="price-wrapper "><span class="price">$394.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="3.94" data-price-type="" class="price-wrapper "><span class="price">$3.94</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-1027" onchange="updateQtyBasedOnTierPriceQty1027(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice1027() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.69,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "163790",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "1027",
"website_price": 4.22,
"price_incl_tax": 4.22,
"price_excl_tax": 4.22
}, {
"price_id": "164354",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "1027",
"website_price": 4.13,
"price_incl_tax": 4.13,
"price_excl_tax": 4.13
}, {
"price_id": "164918",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "1027",
"website_price": 4.03,
"price_incl_tax": 4.03,
"price_excl_tax": 4.03
}, {
"price_id": "165482",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "1027",
"website_price": 3.94,
"price_incl_tax": 3.94,
"price_excl_tax": 3.94
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-1027.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-1027.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice1027()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-1027" id="product-save-price-1027">
</span>
<span class="sd-price-without-discount-amount product-wod-price-1027" id="product-wod-price-1027">
</span>
<span class="price-label block"> </span>
<span id="product-price-1027" class="sd-unit-price product-price-1027">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.69</span> </span> / can </span>
<meta itemprop="price" content="4.69">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-1027" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-1027" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.69</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-1027" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-1027" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField1027 !== 'function') {
function initQtyField1027() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '1027',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField1027()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[1027]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[1027]" form="product_addtocart_form1027" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[1027] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-1027', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form1027" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/1019/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/1019/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form1019">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="1019">
<a href="https://snusdaddy.com/pablo-exclusive-50-mg-blue-raspberry" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-1019.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/p/a/pablo_blue_raspberry_460x460.png" loading="lazy" width="240" height="300" alt="Pablo Exclusive 50 mg Blue Raspberry" title="Pablo Exclusive 50 mg Blue Raspberry">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> Pablo <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/pablo-exclusive-50-mg-blue-raspberry" :id="`slide-desc-1019-${$id('slider-id')}`" id="slide-desc-1019-slider-id-4">
50 mg Blue Raspberry </a>
</div>
<div class="mg-per-pouch"> 30 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty1019 !== 'function') {
function updateQtyBasedOnTierPriceQty1019(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-1019');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[1019]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-1019');
const priceWods = document.getElementsByClassName('product-wod-price-1019');
const priceTotals = document.getElementsByClassName('sd-total-price-1019');
const pricePerCans = document.getElementsByClassName('product-price-1019');
let savePrice = 0;
let customTotalsPrice = 4.39;
var customPerItemPrice = 4.39;
if (qty >= 10) {
savePrice = qty * 0.44;
customTotalsPrice = parseFloat("3.95") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.95;
}
if (qty >= 30) {
savePrice = qty * 0.53;
customTotalsPrice = parseFloat("3.86") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.86;
}
if (qty >= 60) {
savePrice = qty * 0.61;
customTotalsPrice = parseFloat("3.78") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.78;
}
if (qty >= 100) {
savePrice = qty * 0.7;
customTotalsPrice = parseFloat("3.69") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.69;
}
// Calculate the price
const wodPrice = qty * 4.39;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.39);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.39)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-1019 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-1019" onclick="updateQtyBasedOnTierPriceQty1019(this, 1)">
<span>1 can</span>
<span><span class="price">$4.39</span></span>
<span>(<span class="price">$4.39</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-1019" onclick="updateQtyBasedOnTierPriceQty1019(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="39.5" data-price-type="" class="price-wrapper "><span class="price">$39.50</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="3.95" data-price-type="" class="price-wrapper "><span class="price">$3.95</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-1019" onclick="updateQtyBasedOnTierPriceQty1019(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="115.8" data-price-type="" class="price-wrapper "><span class="price">$115.80</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="3.86" data-price-type="" class="price-wrapper "><span class="price">$3.86</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-1019" onclick="updateQtyBasedOnTierPriceQty1019(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="226.8" data-price-type="" class="price-wrapper "><span class="price">$226.80</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="3.78" data-price-type="" class="price-wrapper "><span class="price">$3.78</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-1019" onclick="updateQtyBasedOnTierPriceQty1019(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="369" data-price-type="" class="price-wrapper "><span class="price">$369.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="3.69" data-price-type="" class="price-wrapper "><span class="price">$3.69</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-1019" onchange="updateQtyBasedOnTierPriceQty1019(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice1019() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.39,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "173115",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "1019",
"website_price": 3.95,
"price_incl_tax": 3.95,
"price_excl_tax": 3.95
}, {
"price_id": "173116",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "1019",
"website_price": 3.86,
"price_incl_tax": 3.86,
"price_excl_tax": 3.86
}, {
"price_id": "173117",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "1019",
"website_price": 3.78,
"price_incl_tax": 3.78,
"price_excl_tax": 3.78
}, {
"price_id": "173118",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "1019",
"website_price": 3.69,
"price_incl_tax": 3.69,
"price_excl_tax": 3.69
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-1019.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-1019.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice1019()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-1019" id="product-save-price-1019">
</span>
<span class="sd-price-without-discount-amount product-wod-price-1019" id="product-wod-price-1019">
</span>
<span class="price-label block"> </span>
<span id="product-price-1019" class="sd-unit-price product-price-1019">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.39</span> </span> / can </span>
<meta itemprop="price" content="4.39">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-1019" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-1019" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.39</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-1019" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-1019" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField1019 !== 'function') {
function initQtyField1019() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '1019',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField1019()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[1019]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[1019]" form="product_addtocart_form1019" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[1019] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-1019', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form1019" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/1003/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/1003/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form1003">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="1003">
<a href="https://snusdaddy.com/helwit-cinnapple" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-1003.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/c/i/cinnapple_460x460.png" loading="lazy" width="240" height="300" alt="Helwit Cinnapple" title="Helwit Cinnapple">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> Helwit <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/helwit-cinnapple" :id="`slide-desc-1003-${$id('slider-id')}`" id="slide-desc-1003-slider-id-5">
Cinnapple </a>
</div>
<div class="mg-per-pouch"> 6 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty1003 !== 'function') {
function updateQtyBasedOnTierPriceQty1003(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-1003');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[1003]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-1003');
const priceWods = document.getElementsByClassName('product-wod-price-1003');
const priceTotals = document.getElementsByClassName('sd-total-price-1003');
const pricePerCans = document.getElementsByClassName('product-price-1003');
let savePrice = 0;
let customTotalsPrice = 4.59;
var customPerItemPrice = 4.59;
if (qty >= 10) {
savePrice = qty * 0.46;
customTotalsPrice = parseFloat("4.13") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.13;
}
if (qty >= 30) {
savePrice = qty * 0.55;
customTotalsPrice = parseFloat("4.04") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.04;
}
if (qty >= 60) {
savePrice = qty * 0.64;
customTotalsPrice = parseFloat("3.95") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.95;
}
if (qty >= 100) {
savePrice = qty * 0.73;
customTotalsPrice = parseFloat("3.86") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.86;
}
// Calculate the price
const wodPrice = qty * 4.59;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.59);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.59)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-1003 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-1003" onclick="updateQtyBasedOnTierPriceQty1003(this, 1)">
<span>1 can</span>
<span><span class="price">$4.59</span></span>
<span>(<span class="price">$4.59</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-1003" onclick="updateQtyBasedOnTierPriceQty1003(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="41.3" data-price-type="" class="price-wrapper "><span class="price">$41.30</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="4.13" data-price-type="" class="price-wrapper "><span class="price">$4.13</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-1003" onclick="updateQtyBasedOnTierPriceQty1003(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="121.2" data-price-type="" class="price-wrapper "><span class="price">$121.20</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="4.04" data-price-type="" class="price-wrapper "><span class="price">$4.04</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-1003" onclick="updateQtyBasedOnTierPriceQty1003(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="237" data-price-type="" class="price-wrapper "><span class="price">$237.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="3.95" data-price-type="" class="price-wrapper "><span class="price">$3.95</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-1003" onclick="updateQtyBasedOnTierPriceQty1003(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="386" data-price-type="" class="price-wrapper "><span class="price">$386.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="3.86" data-price-type="" class="price-wrapper "><span class="price">$3.86</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-1003" onchange="updateQtyBasedOnTierPriceQty1003(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice1003() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.59,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "163773",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "1003",
"website_price": 4.13,
"price_incl_tax": 4.13,
"price_excl_tax": 4.13
}, {
"price_id": "164337",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "1003",
"website_price": 4.04,
"price_incl_tax": 4.04,
"price_excl_tax": 4.04
}, {
"price_id": "164901",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "1003",
"website_price": 3.95,
"price_incl_tax": 3.95,
"price_excl_tax": 3.95
}, {
"price_id": "165465",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "1003",
"website_price": 3.86,
"price_incl_tax": 3.86,
"price_excl_tax": 3.86
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-1003.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-1003.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice1003()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-1003" id="product-save-price-1003">
</span>
<span class="sd-price-without-discount-amount product-wod-price-1003" id="product-wod-price-1003">
</span>
<span class="price-label block"> </span>
<span id="product-price-1003" class="sd-unit-price product-price-1003">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.59</span> </span> / can </span>
<meta itemprop="price" content="4.59">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-1003" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-1003" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.59</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-1003" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-1003" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField1003 !== 'function') {
function initQtyField1003() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '1003',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField1003()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[1003]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[1003]" form="product_addtocart_form1003" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[1003] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-1003', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form1003" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/1000/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/1000/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form1000">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="1000">
<a href="https://snusdaddy.com/goat-tropical-12" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-1000.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/g/_/g_tropical_12_460x460.png" loading="lazy" width="240" height="300" alt="GOAT Tropical #12" title="GOAT Tropical #12">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> GOAT <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/goat-tropical-12" :id="`slide-desc-1000-${$id('slider-id')}`" id="slide-desc-1000-slider-id-6">
Tropical #12 </a>
</div>
<div class="mg-per-pouch"> 8.4 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty1000 !== 'function') {
function updateQtyBasedOnTierPriceQty1000(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-1000');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[1000]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-1000');
const priceWods = document.getElementsByClassName('product-wod-price-1000');
const priceTotals = document.getElementsByClassName('sd-total-price-1000');
const pricePerCans = document.getElementsByClassName('product-price-1000');
let savePrice = 0;
let customTotalsPrice = 4.29;
var customPerItemPrice = 4.29;
customTotalsPrice = 4.290000;
customPerItemPrice = 4.290000;
if (qty >= 1) {
savePrice = qty * 1.29; // zz
customTotalsPrice = parseFloat("3") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3;
}
if (qty >= 10) {
savePrice = qty * 1.29;
customTotalsPrice = parseFloat("3") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3;
}
if (qty >= 30) {
savePrice = qty * 1.29;
customTotalsPrice = parseFloat("3") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3;
}
if (qty >= 60) {
savePrice = qty * 1.29;
customTotalsPrice = parseFloat("3") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3;
}
if (qty >= 100) {
savePrice = qty * 1.29;
customTotalsPrice = parseFloat("3") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3;
}
// Calculate the price
const wodPrice = qty * 4.29;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice >= 4.29);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.29)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-1000 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-1000" onclick="updateQtyBasedOnTierPriceQty1000(this, 1)">
<span>1 can</span>
<span><span class="price">$3.00</span></span>
<span>(<span class="price">$3.00</span> / can)</span>
<span class="percent tier-%3">30%</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-1000" onclick="updateQtyBasedOnTierPriceQty1000(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="30" data-price-type="" class="price-wrapper "><span class="price">$30.00</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="3" data-price-type="" class="price-wrapper "><span class="price">$3.00</span></span>
</span> / can)</span>
<span class="percent tier-%3">30%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-1000" onclick="updateQtyBasedOnTierPriceQty1000(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="90" data-price-type="" class="price-wrapper "><span class="price">$90.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="3" data-price-type="" class="price-wrapper "><span class="price">$3.00</span></span>
</span> / can)</span>
<span class="percent tier-%3">30%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-1000" onclick="updateQtyBasedOnTierPriceQty1000(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="180" data-price-type="" class="price-wrapper "><span class="price">$180.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="3" data-price-type="" class="price-wrapper "><span class="price">$3.00</span></span>
</span> / can)</span>
<span class="percent tier-%3">30%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-1000" onclick="updateQtyBasedOnTierPriceQty1000(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="300" data-price-type="" class="price-wrapper "><span class="price">$300.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="3" data-price-type="" class="price-wrapper "><span class="price">$3.00</span></span>
</span> / can)</span>
<span class="percent tier-%3">30%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-1000" onchange="updateQtyBasedOnTierPriceQty1000(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice1000() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 3,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "172781",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "30.00",
"product_id": "1000",
"website_price": 3,
"price_incl_tax": 3,
"price_excl_tax": 3
}, {
"price_id": "172782",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "30.00",
"product_id": "1000",
"website_price": 3,
"price_incl_tax": 3,
"price_excl_tax": 3
}, {
"price_id": "172837",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "30.00",
"product_id": "1000",
"website_price": 3,
"price_incl_tax": 3,
"price_excl_tax": 3
}, {
"price_id": "172838",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "30.00",
"product_id": "1000",
"website_price": 3,
"price_incl_tax": 3,
"price_excl_tax": 3
}],
showRegularPriceLabel: true,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-1000.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-1000.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice1000()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="old-price mr-2 flex" style="display: none;">
<span id="product-price-1000" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(4.29 + getCustomOptionPrice())">
<span class="price">$4.29</span> </span>
</span>
</div>
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-1000" id="product-save-price-1000">
</span>
<span class="sd-price-without-discount-amount product-wod-price-1000" id="product-wod-price-1000">
</span>
<span class="price-label block"> </span>
<span id="product-price-1000" class="sd-unit-price product-price-1000">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$3.00</span> </span> / can </span>
<meta itemprop="price" content="3">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-1000" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-1000" x-html="getFormattedFinalTotalPrice()">
<span class="price">$3.00</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-1000" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-1000" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField1000 !== 'function') {
function initQtyField1000() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '1000',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField1000()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[1000]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[1000]" form="product_addtocart_form1000" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[1000] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-1000', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form1000" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/976/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/976/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form976">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="976">
<a href="https://snusdaddy.com/velo-icy-cherry" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-976.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/i/c/icy_cherry_460x460.png" loading="lazy" width="240" height="300" alt="VELO Icy Cherry Product Label" title="VELO Icy Cherry Product Label">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> VELO <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/velo-icy-cherry" :id="`slide-desc-976-${$id('slider-id')}`" id="slide-desc-976-slider-id-7">
Icy Cherry </a>
</div>
<div class="mg-per-pouch"> 10 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty976 !== 'function') {
function updateQtyBasedOnTierPriceQty976(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-976');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[976]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-976');
const priceWods = document.getElementsByClassName('product-wod-price-976');
const priceTotals = document.getElementsByClassName('sd-total-price-976');
const pricePerCans = document.getElementsByClassName('product-price-976');
let savePrice = 0;
let customTotalsPrice = 5.19;
var customPerItemPrice = 5.19;
if (qty >= 10) {
savePrice = qty * 0.52;
customTotalsPrice = parseFloat("4.67") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.67;
}
if (qty >= 30) {
savePrice = qty * 0.62;
customTotalsPrice = parseFloat("4.57") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.57;
}
if (qty >= 60) {
savePrice = qty * 0.73;
customTotalsPrice = parseFloat("4.46") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.46;
}
if (qty >= 100) {
savePrice = qty * 0.83;
customTotalsPrice = parseFloat("4.36") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.36;
}
// Calculate the price
const wodPrice = qty * 5.19;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 5.19);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 5.19)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-976 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-976" onclick="updateQtyBasedOnTierPriceQty976(this, 1)">
<span>1 can</span>
<span><span class="price">$5.19</span></span>
<span>(<span class="price">$5.19</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-976" onclick="updateQtyBasedOnTierPriceQty976(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="46.7" data-price-type="" class="price-wrapper "><span class="price">$46.70</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="4.67" data-price-type="" class="price-wrapper "><span class="price">$4.67</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-976" onclick="updateQtyBasedOnTierPriceQty976(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="137.1" data-price-type="" class="price-wrapper "><span class="price">$137.10</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="4.57" data-price-type="" class="price-wrapper "><span class="price">$4.57</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-976" onclick="updateQtyBasedOnTierPriceQty976(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="267.6" data-price-type="" class="price-wrapper "><span class="price">$267.60</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="4.46" data-price-type="" class="price-wrapper "><span class="price">$4.46</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-976" onclick="updateQtyBasedOnTierPriceQty976(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="436" data-price-type="" class="price-wrapper "><span class="price">$436.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="4.36" data-price-type="" class="price-wrapper "><span class="price">$4.36</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-976" onchange="updateQtyBasedOnTierPriceQty976(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice976() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 5.19,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "164114",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "976",
"website_price": 4.67,
"price_incl_tax": 4.67,
"price_excl_tax": 4.67
}, {
"price_id": "164663",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "976",
"website_price": 4.57,
"price_incl_tax": 4.57,
"price_excl_tax": 4.57
}, {
"price_id": "165242",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "976",
"website_price": 4.46,
"price_incl_tax": 4.46,
"price_excl_tax": 4.46
}, {
"price_id": "165761",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "976",
"website_price": 4.36,
"price_incl_tax": 4.36,
"price_excl_tax": 4.36
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-976.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-976.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice976()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-976" id="product-save-price-976">
</span>
<span class="sd-price-without-discount-amount product-wod-price-976" id="product-wod-price-976">
</span>
<span class="price-label block"> </span>
<span id="product-price-976" class="sd-unit-price product-price-976">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$5.19</span> </span> / can </span>
<meta itemprop="price" content="5.19">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-976" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-976" x-html="getFormattedFinalTotalPrice()">
<span class="price">$5.19</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-976" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-976" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField976 !== 'function') {
function initQtyField976() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '976',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField976()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[976]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[976]" form="product_addtocart_form976" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[976] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-976', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form976" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/958/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/958/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form958">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="958">
<a href="https://snusdaddy.com/kelly-white-sparkling-strawberry-slim" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-958.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/s/p/sparkling_strawberry_460x460.png" loading="lazy" width="240" height="300" alt="Kelly White Sparkling Strawberry Slim Product Label" title="Kelly White Sparkling Strawberry Slim Product Label">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> Kelly White <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/kelly-white-sparkling-strawberry-slim" :id="`slide-desc-958-${$id('slider-id')}`" id="slide-desc-958-slider-id-8">
Sparkling Strawberry Slim </a>
</div>
<div class="mg-per-pouch"> 4.8 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty958 !== 'function') {
function updateQtyBasedOnTierPriceQty958(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-958');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[958]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-958');
const priceWods = document.getElementsByClassName('product-wod-price-958');
const priceTotals = document.getElementsByClassName('sd-total-price-958');
const pricePerCans = document.getElementsByClassName('product-price-958');
let savePrice = 0;
let customTotalsPrice = 4.29;
var customPerItemPrice = 4.29;
if (qty >= 10) {
savePrice = qty * 0.43;
customTotalsPrice = parseFloat("3.86") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.86;
}
if (qty >= 30) {
savePrice = qty * 0.51;
customTotalsPrice = parseFloat("3.78") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.78;
}
if (qty >= 60) {
savePrice = qty * 0.6;
customTotalsPrice = parseFloat("3.69") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.69;
}
if (qty >= 100) {
savePrice = qty * 0.69;
customTotalsPrice = parseFloat("3.6") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.6;
}
// Calculate the price
const wodPrice = qty * 4.29;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.29);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.29)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-958 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-958" onclick="updateQtyBasedOnTierPriceQty958(this, 1)">
<span>1 can</span>
<span><span class="price">$4.29</span></span>
<span>(<span class="price">$4.29</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-958" onclick="updateQtyBasedOnTierPriceQty958(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="38.6" data-price-type="" class="price-wrapper "><span class="price">$38.60</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="3.86" data-price-type="" class="price-wrapper "><span class="price">$3.86</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-958" onclick="updateQtyBasedOnTierPriceQty958(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="113.4" data-price-type="" class="price-wrapper "><span class="price">$113.40</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="3.78" data-price-type="" class="price-wrapper "><span class="price">$3.78</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-958" onclick="updateQtyBasedOnTierPriceQty958(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="221.4" data-price-type="" class="price-wrapper "><span class="price">$221.40</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="3.69" data-price-type="" class="price-wrapper "><span class="price">$3.69</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-958" onclick="updateQtyBasedOnTierPriceQty958(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="360" data-price-type="" class="price-wrapper "><span class="price">$360.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="3.6" data-price-type="" class="price-wrapper "><span class="price">$3.60</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-958" onchange="updateQtyBasedOnTierPriceQty958(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice958() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.29,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "163819",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "958",
"website_price": 3.86,
"price_incl_tax": 3.86,
"price_excl_tax": 3.86
}, {
"price_id": "164383",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "958",
"website_price": 3.78,
"price_incl_tax": 3.78,
"price_excl_tax": 3.78
}, {
"price_id": "164947",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "958",
"website_price": 3.69,
"price_incl_tax": 3.69,
"price_excl_tax": 3.69
}, {
"price_id": "165511",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "958",
"website_price": 3.6,
"price_incl_tax": 3.6,
"price_excl_tax": 3.6
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-958.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-958.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice958()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-958" id="product-save-price-958">
</span>
<span class="sd-price-without-discount-amount product-wod-price-958" id="product-wod-price-958">
</span>
<span class="price-label block"> </span>
<span id="product-price-958" class="sd-unit-price product-price-958">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.29</span> </span> / can </span>
<meta itemprop="price" content="4.29">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-958" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-958" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.29</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-958" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-958" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField958 !== 'function') {
function initQtyField958() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '958',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField958()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[958]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[958]" form="product_addtocart_form958" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[958] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-958', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form958" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/895/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/895/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form895">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="895">
<a href="https://snusdaddy.com/velo-groovy-grape-mini" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-895.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/v/e/velo_groovy_grape_mini_460x460.png" loading="lazy" width="240" height="300" alt="VELO Groovy Grape Mini Product Label Peeling" title="VELO Groovy Grape Mini Product Label Peeling">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> VELO <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/velo-groovy-grape-mini" :id="`slide-desc-895-${$id('slider-id')}`" id="slide-desc-895-slider-id-9">
Groovy Grape Mini </a>
</div>
<div class="mg-per-pouch"> 6 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty895 !== 'function') {
function updateQtyBasedOnTierPriceQty895(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-895');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[895]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-895');
const priceWods = document.getElementsByClassName('product-wod-price-895');
const priceTotals = document.getElementsByClassName('sd-total-price-895');
const pricePerCans = document.getElementsByClassName('product-price-895');
let savePrice = 0;
let customTotalsPrice = 5.19;
var customPerItemPrice = 5.19;
if (qty >= 10) {
savePrice = qty * 0.52;
customTotalsPrice = parseFloat("4.67") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.67;
}
if (qty >= 30) {
savePrice = qty * 0.62;
customTotalsPrice = parseFloat("4.57") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.57;
}
if (qty >= 60) {
savePrice = qty * 0.73;
customTotalsPrice = parseFloat("4.46") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.46;
}
if (qty >= 100) {
savePrice = qty * 0.83;
customTotalsPrice = parseFloat("4.36") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.36;
}
// Calculate the price
const wodPrice = qty * 5.19;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 5.19);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 5.19)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-895 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-895" onclick="updateQtyBasedOnTierPriceQty895(this, 1)">
<span>1 can</span>
<span><span class="price">$5.19</span></span>
<span>(<span class="price">$5.19</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-895" onclick="updateQtyBasedOnTierPriceQty895(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="46.7" data-price-type="" class="price-wrapper "><span class="price">$46.70</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="4.67" data-price-type="" class="price-wrapper "><span class="price">$4.67</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-895" onclick="updateQtyBasedOnTierPriceQty895(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="137.1" data-price-type="" class="price-wrapper "><span class="price">$137.10</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="4.57" data-price-type="" class="price-wrapper "><span class="price">$4.57</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-895" onclick="updateQtyBasedOnTierPriceQty895(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="267.6" data-price-type="" class="price-wrapper "><span class="price">$267.60</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="4.46" data-price-type="" class="price-wrapper "><span class="price">$4.46</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-895" onclick="updateQtyBasedOnTierPriceQty895(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="436" data-price-type="" class="price-wrapper "><span class="price">$436.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="4.36" data-price-type="" class="price-wrapper "><span class="price">$4.36</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-895" onchange="updateQtyBasedOnTierPriceQty895(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice895() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 5.19,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "164055",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "895",
"website_price": 4.67,
"price_incl_tax": 4.67,
"price_excl_tax": 4.67
}, {
"price_id": "164654",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "895",
"website_price": 4.57,
"price_incl_tax": 4.57,
"price_excl_tax": 4.57
}, {
"price_id": "165233",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "895",
"website_price": 4.46,
"price_incl_tax": 4.46,
"price_excl_tax": 4.46
}, {
"price_id": "165752",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "895",
"website_price": 4.36,
"price_incl_tax": 4.36,
"price_excl_tax": 4.36
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-895.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-895.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice895()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-895" id="product-save-price-895">
</span>
<span class="sd-price-without-discount-amount product-wod-price-895" id="product-wod-price-895">
</span>
<span class="price-label block"> </span>
<span id="product-price-895" class="sd-unit-price product-price-895">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$5.19</span> </span> / can </span>
<meta itemprop="price" content="5.19">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-895" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-895" x-html="getFormattedFinalTotalPrice()">
<span class="price">$5.19</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-895" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-895" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField895 !== 'function') {
function initQtyField895() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '895',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField895()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[895]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[895]" form="product_addtocart_form895" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[895] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-895', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form895" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/795/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/795/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form795">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="795">
<a href="https://snusdaddy.com/xqs-black-cherry-strong" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-795.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/b/l/black_cherry_strong_460x460_1.png" loading="lazy" width="240" height="300" alt="XQS Black Cherry Strong Product Label" title="XQS Black Cherry Strong Product Label">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> XQS <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/xqs-black-cherry-strong" :id="`slide-desc-795-${$id('slider-id')}`" id="slide-desc-795-slider-id-11">
Black Cherry Strong </a>
</div>
<div class="mg-per-pouch"> 8 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty795 !== 'function') {
function updateQtyBasedOnTierPriceQty795(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-795');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[795]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-795');
const priceWods = document.getElementsByClassName('product-wod-price-795');
const priceTotals = document.getElementsByClassName('sd-total-price-795');
const pricePerCans = document.getElementsByClassName('product-price-795');
let savePrice = 0;
let customTotalsPrice = 4.69;
var customPerItemPrice = 4.69;
if (qty >= 10) {
savePrice = qty * 0.47;
customTotalsPrice = parseFloat("4.22") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.22;
}
if (qty >= 30) {
savePrice = qty * 0.56;
customTotalsPrice = parseFloat("4.13") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.13;
}
if (qty >= 60) {
savePrice = qty * 0.66;
customTotalsPrice = parseFloat("4.03") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.03;
}
if (qty >= 100) {
savePrice = qty * 0.75;
customTotalsPrice = parseFloat("3.94") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.94;
}
// Calculate the price
const wodPrice = qty * 4.69;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.69);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.69)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-795 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-795" onclick="updateQtyBasedOnTierPriceQty795(this, 1)">
<span>1 can</span>
<span><span class="price">$4.69</span></span>
<span>(<span class="price">$4.69</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-795" onclick="updateQtyBasedOnTierPriceQty795(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="42.2" data-price-type="" class="price-wrapper "><span class="price">$42.20</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="4.22" data-price-type="" class="price-wrapper "><span class="price">$4.22</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-795" onclick="updateQtyBasedOnTierPriceQty795(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="123.9" data-price-type="" class="price-wrapper "><span class="price">$123.90</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="4.13" data-price-type="" class="price-wrapper "><span class="price">$4.13</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-795" onclick="updateQtyBasedOnTierPriceQty795(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="241.8" data-price-type="" class="price-wrapper "><span class="price">$241.80</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="4.03" data-price-type="" class="price-wrapper "><span class="price">$4.03</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-795" onclick="updateQtyBasedOnTierPriceQty795(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="394" data-price-type="" class="price-wrapper "><span class="price">$394.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="3.94" data-price-type="" class="price-wrapper "><span class="price">$3.94</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-795" onchange="updateQtyBasedOnTierPriceQty795(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice795() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.69,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "164174",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "795",
"website_price": 4.22,
"price_incl_tax": 4.22,
"price_excl_tax": 4.22
}, {
"price_id": "164738",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "795",
"website_price": 4.13,
"price_incl_tax": 4.13,
"price_excl_tax": 4.13
}, {
"price_id": "165302",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "795",
"website_price": 4.03,
"price_incl_tax": 4.03,
"price_excl_tax": 4.03
}, {
"price_id": "165866",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "795",
"website_price": 3.94,
"price_incl_tax": 3.94,
"price_excl_tax": 3.94
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-795.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-795.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice795()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-795" id="product-save-price-795">
</span>
<span class="sd-price-without-discount-amount product-wod-price-795" id="product-wod-price-795">
</span>
<span class="price-label block"> </span>
<span id="product-price-795" class="sd-unit-price product-price-795">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.69</span> </span> / can </span>
<meta itemprop="price" content="4.69">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-795" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-795" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.69</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-795" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-795" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField795 !== 'function') {
function initQtyField795() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '795',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField795()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[795]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[795]" form="product_addtocart_form795" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[795] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-795', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form795" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/145/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/145/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form145">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="145">
<a href="https://snusdaddy.com/oden-s-cold-extreme-white-dry-portion" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-145.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/c/o/cold_dry_460x460.png" loading="lazy" width="240" height="300" alt="Odens Cold Extreme White Dry Portion Product Label" title="Odens Cold Extreme White Dry Portion Product Label">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> Oden's <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 4 </div>
<div class="sd-star-light-green"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/oden-s-cold-extreme-white-dry-portion" :id="`slide-desc-145-${$id('slider-id')}`" id="slide-desc-145-slider-id-12">
Cold Extreme White Dry Portion </a>
</div>
<div class="mg-per-pouch"> 17.6 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty145 !== 'function') {
function updateQtyBasedOnTierPriceQty145(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-145');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[145]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-145');
const priceWods = document.getElementsByClassName('product-wod-price-145');
const priceTotals = document.getElementsByClassName('sd-total-price-145');
const pricePerCans = document.getElementsByClassName('product-price-145');
let savePrice = 0;
let customTotalsPrice = 3.49;
var customPerItemPrice = 3.49;
if (qty >= 10) {
savePrice = qty * 0.35;
customTotalsPrice = parseFloat("3.14") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.14;
}
if (qty >= 30) {
savePrice = qty * 0.42;
customTotalsPrice = parseFloat("3.07") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.07;
}
if (qty >= 60) {
savePrice = qty * 0.49;
customTotalsPrice = parseFloat("3") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3;
}
if (qty >= 100) {
savePrice = qty * 0.56;
customTotalsPrice = parseFloat("2.93") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 2.93;
}
// Calculate the price
const wodPrice = qty * 3.49;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 3.49);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 3.49)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-145 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-145" onclick="updateQtyBasedOnTierPriceQty145(this, 1)">
<span>1 can</span>
<span><span class="price">$3.49</span></span>
<span>(<span class="price">$3.49</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-145" onclick="updateQtyBasedOnTierPriceQty145(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="31.4" data-price-type="" class="price-wrapper "><span class="price">$31.40</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="3.14" data-price-type="" class="price-wrapper "><span class="price">$3.14</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-145" onclick="updateQtyBasedOnTierPriceQty145(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="92.1" data-price-type="" class="price-wrapper "><span class="price">$92.10</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="3.07" data-price-type="" class="price-wrapper "><span class="price">$3.07</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-145" onclick="updateQtyBasedOnTierPriceQty145(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="180" data-price-type="" class="price-wrapper "><span class="price">$180.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="3" data-price-type="" class="price-wrapper "><span class="price">$3.00</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-145" onclick="updateQtyBasedOnTierPriceQty145(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="293" data-price-type="" class="price-wrapper "><span class="price">$293.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="2.93" data-price-type="" class="price-wrapper "><span class="price">$2.93</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-145" onchange="updateQtyBasedOnTierPriceQty145(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice145() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 3.49,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "157364",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "145",
"website_price": 3.14,
"price_incl_tax": 3.14,
"price_excl_tax": 3.14
}, {
"price_id": "157980",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "145",
"website_price": 3.07,
"price_incl_tax": 3.07,
"price_excl_tax": 3.07
}, {
"price_id": "158596",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "145",
"website_price": 3,
"price_incl_tax": 3,
"price_excl_tax": 3
}, {
"price_id": "159212",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "145",
"website_price": 2.93,
"price_incl_tax": 2.93,
"price_excl_tax": 2.93
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-145.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-145.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice145()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-145" id="product-save-price-145">
</span>
<span class="sd-price-without-discount-amount product-wod-price-145" id="product-wod-price-145">
</span>
<span class="price-label block"> </span>
<span id="product-price-145" class="sd-unit-price product-price-145">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$3.49</span> </span> / can </span>
<meta itemprop="price" content="3.49">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-145" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-145" x-html="getFormattedFinalTotalPrice()">
<span class="price">$3.49</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-145" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-145" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField145 !== 'function') {
function initQtyField145() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '145',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField145()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[145]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[145]" form="product_addtocart_form145" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[145] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-145', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form145" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/650/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/650/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form650">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="650">
<a href="https://snusdaddy.com/zyn-mini-black-cherry-3-mg" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-650.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/b/l/black_cherry_460x460.png" loading="lazy" width="240" height="300" alt="ZYN Mini Black Cherry 3 mg Product Label" title="ZYN Mini Black Cherry 3 mg Product Label">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> ZYN <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 4.8 </div>
<div class="sd-star-green"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/zyn-mini-black-cherry-3-mg" :id="`slide-desc-650-${$id('slider-id')}`" id="slide-desc-650-slider-id-13">
Mini Dry Black Cherry 3 mg </a>
</div>
<div class="mg-per-pouch"> 3 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty650 !== 'function') {
function updateQtyBasedOnTierPriceQty650(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-650');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[650]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-650');
const priceWods = document.getElementsByClassName('product-wod-price-650');
const priceTotals = document.getElementsByClassName('sd-total-price-650');
const pricePerCans = document.getElementsByClassName('product-price-650');
let savePrice = 0;
let customTotalsPrice = 4.99;
var customPerItemPrice = 4.99;
if (qty >= 10) {
savePrice = qty * 0.5;
customTotalsPrice = parseFloat("4.49") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.49;
}
if (qty >= 30) {
savePrice = qty * 0.6;
customTotalsPrice = parseFloat("4.39") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.39;
}
if (qty >= 60) {
savePrice = qty * 0.7;
customTotalsPrice = parseFloat("4.29") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.29;
}
if (qty >= 100) {
savePrice = qty * 0.8;
customTotalsPrice = parseFloat("4.19") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.19;
}
// Calculate the price
const wodPrice = qty * 4.99;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.99);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.99)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-650 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-650" onclick="updateQtyBasedOnTierPriceQty650(this, 1)">
<span>1 can</span>
<span><span class="price">$4.99</span></span>
<span>(<span class="price">$4.99</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-650" onclick="updateQtyBasedOnTierPriceQty650(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="44.9" data-price-type="" class="price-wrapper "><span class="price">$44.90</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="4.49" data-price-type="" class="price-wrapper "><span class="price">$4.49</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-650" onclick="updateQtyBasedOnTierPriceQty650(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="131.7" data-price-type="" class="price-wrapper "><span class="price">$131.70</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="4.39" data-price-type="" class="price-wrapper "><span class="price">$4.39</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-650" onclick="updateQtyBasedOnTierPriceQty650(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="257.4" data-price-type="" class="price-wrapper "><span class="price">$257.40</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="4.29" data-price-type="" class="price-wrapper "><span class="price">$4.29</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-650" onclick="updateQtyBasedOnTierPriceQty650(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="419" data-price-type="" class="price-wrapper "><span class="price">$419.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="4.19" data-price-type="" class="price-wrapper "><span class="price">$4.19</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-650" onchange="updateQtyBasedOnTierPriceQty650(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice650() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.99,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "164224",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "650",
"website_price": 4.49,
"price_incl_tax": 4.49,
"price_excl_tax": 4.49
}, {
"price_id": "164788",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "650",
"website_price": 4.39,
"price_incl_tax": 4.39,
"price_excl_tax": 4.39
}, {
"price_id": "165352",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "650",
"website_price": 4.29,
"price_incl_tax": 4.29,
"price_excl_tax": 4.29
}, {
"price_id": "165916",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "650",
"website_price": 4.19,
"price_incl_tax": 4.19,
"price_excl_tax": 4.19
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-650.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-650.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice650()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-650" id="product-save-price-650">
</span>
<span class="sd-price-without-discount-amount product-wod-price-650" id="product-wod-price-650">
</span>
<span class="price-label block"> </span>
<span id="product-price-650" class="sd-unit-price product-price-650">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.99</span> </span> / can </span>
<meta itemprop="price" content="4.99">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-650" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-650" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.99</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-650" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-650" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField650 !== 'function') {
function initQtyField650() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '650',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField650()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[650]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[650]" form="product_addtocart_form650" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[650] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-650', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form650" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/651/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/651/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form651">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="651">
<a href="https://snusdaddy.com/zyn-mini-black-cherry-6-mg" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-651.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/b/l/black_cherry_strong_460x460.png" loading="lazy" width="240" height="300" alt="ZYN Mini Black Cherry 6 mg Product Label" title="ZYN Mini Black Cherry 6 mg Product Label">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> ZYN <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 4.7 </div>
<div class="sd-star-green"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/zyn-mini-black-cherry-6-mg" :id="`slide-desc-651-${$id('slider-id')}`" id="slide-desc-651-slider-id-14">
Mini Dry Black Cherry 6 mg </a>
</div>
<div class="mg-per-pouch"> 6 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty651 !== 'function') {
function updateQtyBasedOnTierPriceQty651(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-651');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[651]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-651');
const priceWods = document.getElementsByClassName('product-wod-price-651');
const priceTotals = document.getElementsByClassName('sd-total-price-651');
const pricePerCans = document.getElementsByClassName('product-price-651');
let savePrice = 0;
let customTotalsPrice = 4.99;
var customPerItemPrice = 4.99;
if (qty >= 10) {
savePrice = qty * 0.5;
customTotalsPrice = parseFloat("4.49") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.49;
}
if (qty >= 30) {
savePrice = qty * 0.6;
customTotalsPrice = parseFloat("4.39") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.39;
}
if (qty >= 60) {
savePrice = qty * 0.7;
customTotalsPrice = parseFloat("4.29") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.29;
}
if (qty >= 100) {
savePrice = qty * 0.8;
customTotalsPrice = parseFloat("4.19") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.19;
}
// Calculate the price
const wodPrice = qty * 4.99;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.99);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.99)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-651 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-651" onclick="updateQtyBasedOnTierPriceQty651(this, 1)">
<span>1 can</span>
<span><span class="price">$4.99</span></span>
<span>(<span class="price">$4.99</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-651" onclick="updateQtyBasedOnTierPriceQty651(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="44.9" data-price-type="" class="price-wrapper "><span class="price">$44.90</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="4.49" data-price-type="" class="price-wrapper "><span class="price">$4.49</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-651" onclick="updateQtyBasedOnTierPriceQty651(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="131.7" data-price-type="" class="price-wrapper "><span class="price">$131.70</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="4.39" data-price-type="" class="price-wrapper "><span class="price">$4.39</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-651" onclick="updateQtyBasedOnTierPriceQty651(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="257.4" data-price-type="" class="price-wrapper "><span class="price">$257.40</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="4.29" data-price-type="" class="price-wrapper "><span class="price">$4.29</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-651" onclick="updateQtyBasedOnTierPriceQty651(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="419" data-price-type="" class="price-wrapper "><span class="price">$419.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="4.19" data-price-type="" class="price-wrapper "><span class="price">$4.19</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-651" onchange="updateQtyBasedOnTierPriceQty651(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice651() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.99,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "164225",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "651",
"website_price": 4.49,
"price_incl_tax": 4.49,
"price_excl_tax": 4.49
}, {
"price_id": "164789",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "651",
"website_price": 4.39,
"price_incl_tax": 4.39,
"price_excl_tax": 4.39
}, {
"price_id": "165353",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "651",
"website_price": 4.29,
"price_incl_tax": 4.29,
"price_excl_tax": 4.29
}, {
"price_id": "165917",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "651",
"website_price": 4.19,
"price_incl_tax": 4.19,
"price_excl_tax": 4.19
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-651.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-651.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice651()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-651" id="product-save-price-651">
</span>
<span class="sd-price-without-discount-amount product-wod-price-651" id="product-wod-price-651">
</span>
<span class="price-label block"> </span>
<span id="product-price-651" class="sd-unit-price product-price-651">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.99</span> </span> / can </span>
<meta itemprop="price" content="4.99">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-651" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-651" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.99</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-651" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-651" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField651 !== 'function') {
function initQtyField651() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '651',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField651()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[651]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[651]" form="product_addtocart_form651" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[651] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-651', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form651" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/695/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/695/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form695">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="695">
<a href="https://snusdaddy.com/helwit-cherry" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-695.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/c/h/cherry_460x460.png" loading="lazy" width="240" height="300" alt="Helwit Cherry Product Label" title="Helwit Cherry Product Label">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> Helwit <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/helwit-cherry" :id="`slide-desc-695-${$id('slider-id')}`" id="slide-desc-695-slider-id-15">
Cherry </a>
</div>
<div class="mg-per-pouch"> 4.5 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty695 !== 'function') {
function updateQtyBasedOnTierPriceQty695(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-695');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[695]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-695');
const priceWods = document.getElementsByClassName('product-wod-price-695');
const priceTotals = document.getElementsByClassName('sd-total-price-695');
const pricePerCans = document.getElementsByClassName('product-price-695');
let savePrice = 0;
let customTotalsPrice = 4.59;
var customPerItemPrice = 4.59;
if (qty >= 10) {
savePrice = qty * 0.46;
customTotalsPrice = parseFloat("4.13") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.13;
}
if (qty >= 30) {
savePrice = qty * 0.55;
customTotalsPrice = parseFloat("4.04") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.04;
}
if (qty >= 60) {
savePrice = qty * 0.64;
customTotalsPrice = parseFloat("3.95") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.95;
}
if (qty >= 100) {
savePrice = qty * 0.73;
customTotalsPrice = parseFloat("3.86") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.86;
}
// Calculate the price
const wodPrice = qty * 4.59;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.59);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.59)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-695 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-695" onclick="updateQtyBasedOnTierPriceQty695(this, 1)">
<span>1 can</span>
<span><span class="price">$4.59</span></span>
<span>(<span class="price">$4.59</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-695" onclick="updateQtyBasedOnTierPriceQty695(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="41.3" data-price-type="" class="price-wrapper "><span class="price">$41.30</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="4.13" data-price-type="" class="price-wrapper "><span class="price">$4.13</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-695" onclick="updateQtyBasedOnTierPriceQty695(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="121.2" data-price-type="" class="price-wrapper "><span class="price">$121.20</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="4.04" data-price-type="" class="price-wrapper "><span class="price">$4.04</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-695" onclick="updateQtyBasedOnTierPriceQty695(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="237" data-price-type="" class="price-wrapper "><span class="price">$237.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="3.95" data-price-type="" class="price-wrapper "><span class="price">$3.95</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-695" onclick="updateQtyBasedOnTierPriceQty695(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="386" data-price-type="" class="price-wrapper "><span class="price">$386.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="3.86" data-price-type="" class="price-wrapper "><span class="price">$3.86</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-695" onchange="updateQtyBasedOnTierPriceQty695(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice695() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.59,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "163772",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "695",
"website_price": 4.13,
"price_incl_tax": 4.13,
"price_excl_tax": 4.13
}, {
"price_id": "164336",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "695",
"website_price": 4.04,
"price_incl_tax": 4.04,
"price_excl_tax": 4.04
}, {
"price_id": "164900",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "695",
"website_price": 3.95,
"price_incl_tax": 3.95,
"price_excl_tax": 3.95
}, {
"price_id": "165464",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "695",
"website_price": 3.86,
"price_incl_tax": 3.86,
"price_excl_tax": 3.86
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-695.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-695.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice695()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-695" id="product-save-price-695">
</span>
<span class="sd-price-without-discount-amount product-wod-price-695" id="product-wod-price-695">
</span>
<span class="price-label block"> </span>
<span id="product-price-695" class="sd-unit-price product-price-695">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.59</span> </span> / can </span>
<meta itemprop="price" content="4.59">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-695" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-695" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.59</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-695" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-695" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField695 !== 'function') {
function initQtyField695() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '695',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField695()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[695]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[695]" form="product_addtocart_form695" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[695] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-695', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form695" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/752/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/752/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form752">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="752">
<a href="https://snusdaddy.com/candys-ice-cherry-gum" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-752.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/c/a/candys_ice_cherry_gum_460x460.png" loading="lazy" width="240" height="300" alt="Candys Ice Cherry Gum Product Label" title="Candys Ice Cherry Gum Product Label">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> Candys <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/candys-ice-cherry-gum" :id="`slide-desc-752-${$id('slider-id')}`" id="slide-desc-752-slider-id-16">
Ice Cherry Gum </a>
</div>
<div class="mg-per-pouch"> 33.5 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty752 !== 'function') {
function updateQtyBasedOnTierPriceQty752(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-752');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[752]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-752');
const priceWods = document.getElementsByClassName('product-wod-price-752');
const priceTotals = document.getElementsByClassName('sd-total-price-752');
const pricePerCans = document.getElementsByClassName('product-price-752');
let savePrice = 0;
let customTotalsPrice = 4.39;
var customPerItemPrice = 4.39;
if (qty >= 10) {
savePrice = qty * 0.44;
customTotalsPrice = parseFloat("3.95") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.95;
}
if (qty >= 30) {
savePrice = qty * 0.53;
customTotalsPrice = parseFloat("3.86") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.86;
}
if (qty >= 60) {
savePrice = qty * 0.61;
customTotalsPrice = parseFloat("3.78") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.78;
}
if (qty >= 100) {
savePrice = qty * 0.7;
customTotalsPrice = parseFloat("3.69") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.69;
}
// Calculate the price
const wodPrice = qty * 4.39;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.39);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.39)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-752 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-752" onclick="updateQtyBasedOnTierPriceQty752(this, 1)">
<span>1 can</span>
<span><span class="price">$4.39</span></span>
<span>(<span class="price">$4.39</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-752" onclick="updateQtyBasedOnTierPriceQty752(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="39.5" data-price-type="" class="price-wrapper "><span class="price">$39.50</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="3.95" data-price-type="" class="price-wrapper "><span class="price">$3.95</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-752" onclick="updateQtyBasedOnTierPriceQty752(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="115.8" data-price-type="" class="price-wrapper "><span class="price">$115.80</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="3.86" data-price-type="" class="price-wrapper "><span class="price">$3.86</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-752" onclick="updateQtyBasedOnTierPriceQty752(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="226.8" data-price-type="" class="price-wrapper "><span class="price">$226.80</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="3.78" data-price-type="" class="price-wrapper "><span class="price">$3.78</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-752" onclick="updateQtyBasedOnTierPriceQty752(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="369" data-price-type="" class="price-wrapper "><span class="price">$369.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="3.69" data-price-type="" class="price-wrapper "><span class="price">$3.69</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-752" onchange="updateQtyBasedOnTierPriceQty752(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice752() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.39,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "163733",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "752",
"website_price": 3.95,
"price_incl_tax": 3.95,
"price_excl_tax": 3.95
}, {
"price_id": "164297",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "752",
"website_price": 3.86,
"price_incl_tax": 3.86,
"price_excl_tax": 3.86
}, {
"price_id": "164861",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "752",
"website_price": 3.78,
"price_incl_tax": 3.78,
"price_excl_tax": 3.78
}, {
"price_id": "165425",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "752",
"website_price": 3.69,
"price_incl_tax": 3.69,
"price_excl_tax": 3.69
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-752.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-752.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice752()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-752" id="product-save-price-752">
</span>
<span class="sd-price-without-discount-amount product-wod-price-752" id="product-wod-price-752">
</span>
<span class="price-label block"> </span>
<span id="product-price-752" class="sd-unit-price product-price-752">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.39</span> </span> / can </span>
<meta itemprop="price" content="4.39">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-752" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-752" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.39</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-752" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-752" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField752 !== 'function') {
function initQtyField752() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '752',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField752()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[752]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[752]" form="product_addtocart_form752" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[752] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-752', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form752" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/756/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/756/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form756">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="756">
<a href="https://snusdaddy.com/fedrs-tobacco-cherry-hard" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-756.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/t/o/tobacco_cherry_hard_460x460.png" loading="lazy" width="240" height="300" alt="FEDRS Tobacco Cherry Hard Product Label" title="FEDRS Tobacco Cherry Hard Product Label">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> FEDRS <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/fedrs-tobacco-cherry-hard" :id="`slide-desc-756-${$id('slider-id')}`" id="slide-desc-756-slider-id-17">
Tobacco Cherry Hard </a>
</div>
<div class="mg-per-pouch"> 32.5 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty756 !== 'function') {
function updateQtyBasedOnTierPriceQty756(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-756');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[756]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-756');
const priceWods = document.getElementsByClassName('product-wod-price-756');
const priceTotals = document.getElementsByClassName('sd-total-price-756');
const pricePerCans = document.getElementsByClassName('product-price-756');
let savePrice = 0;
let customTotalsPrice = 5.29;
var customPerItemPrice = 5.29;
if (qty >= 10) {
savePrice = qty * 0.53;
customTotalsPrice = parseFloat("4.76") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.76;
}
if (qty >= 30) {
savePrice = qty * 0.63;
customTotalsPrice = parseFloat("4.66") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.66;
}
if (qty >= 60) {
savePrice = qty * 0.74;
customTotalsPrice = parseFloat("4.55") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.55;
}
if (qty >= 100) {
savePrice = qty * 0.85;
customTotalsPrice = parseFloat("4.44") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.44;
}
// Calculate the price
const wodPrice = qty * 5.29;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 5.29);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 5.29)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-756 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-756" onclick="updateQtyBasedOnTierPriceQty756(this, 1)">
<span>1 can</span>
<span><span class="price">$5.29</span></span>
<span>(<span class="price">$5.29</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-756" onclick="updateQtyBasedOnTierPriceQty756(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="47.6" data-price-type="" class="price-wrapper "><span class="price">$47.60</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="4.76" data-price-type="" class="price-wrapper "><span class="price">$4.76</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-756" onclick="updateQtyBasedOnTierPriceQty756(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="139.8" data-price-type="" class="price-wrapper "><span class="price">$139.80</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="4.66" data-price-type="" class="price-wrapper "><span class="price">$4.66</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-756" onclick="updateQtyBasedOnTierPriceQty756(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="273" data-price-type="" class="price-wrapper "><span class="price">$273.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="4.55" data-price-type="" class="price-wrapper "><span class="price">$4.55</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-756" onclick="updateQtyBasedOnTierPriceQty756(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="444" data-price-type="" class="price-wrapper "><span class="price">$444.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="4.44" data-price-type="" class="price-wrapper "><span class="price">$4.44</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-756" onchange="updateQtyBasedOnTierPriceQty756(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice756() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 5.29,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "163765",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "756",
"website_price": 4.76,
"price_incl_tax": 4.76,
"price_excl_tax": 4.76
}, {
"price_id": "164329",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "756",
"website_price": 4.66,
"price_incl_tax": 4.66,
"price_excl_tax": 4.66
}, {
"price_id": "164893",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "756",
"website_price": 4.55,
"price_incl_tax": 4.55,
"price_excl_tax": 4.55
}, {
"price_id": "165457",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "756",
"website_price": 4.44,
"price_incl_tax": 4.44,
"price_excl_tax": 4.44
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-756.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-756.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice756()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-756" id="product-save-price-756">
</span>
<span class="sd-price-without-discount-amount product-wod-price-756" id="product-wod-price-756">
</span>
<span class="price-label block"> </span>
<span id="product-price-756" class="sd-unit-price product-price-756">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$5.29</span> </span> / can </span>
<meta itemprop="price" content="5.29">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-756" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-756" x-html="getFormattedFinalTotalPrice()">
<span class="price">$5.29</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-756" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-756" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField756 !== 'function') {
function initQtyField756() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '756',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField756()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[756]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[756]" form="product_addtocart_form756" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[756] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-756', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form756" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/795/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/795/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form795">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="795">
<a href="https://snusdaddy.com/xqs-black-cherry-strong" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-795.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/b/l/black_cherry_strong_460x460_1.png" loading="lazy" width="240" height="300" alt="XQS Black Cherry Strong Product Label" title="XQS Black Cherry Strong Product Label">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> XQS <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/xqs-black-cherry-strong" :id="`slide-desc-795-${$id('slider-id')}`" id="slide-desc-795-slider-id-18">
Black Cherry Strong </a>
</div>
<div class="mg-per-pouch"> 8 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty795 !== 'function') {
function updateQtyBasedOnTierPriceQty795(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-795');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[795]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-795');
const priceWods = document.getElementsByClassName('product-wod-price-795');
const priceTotals = document.getElementsByClassName('sd-total-price-795');
const pricePerCans = document.getElementsByClassName('product-price-795');
let savePrice = 0;
let customTotalsPrice = 4.69;
var customPerItemPrice = 4.69;
if (qty >= 10) {
savePrice = qty * 0.47;
customTotalsPrice = parseFloat("4.22") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.22;
}
if (qty >= 30) {
savePrice = qty * 0.56;
customTotalsPrice = parseFloat("4.13") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.13;
}
if (qty >= 60) {
savePrice = qty * 0.66;
customTotalsPrice = parseFloat("4.03") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.03;
}
if (qty >= 100) {
savePrice = qty * 0.75;
customTotalsPrice = parseFloat("3.94") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.94;
}
// Calculate the price
const wodPrice = qty * 4.69;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.69);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.69)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-795 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-795" onclick="updateQtyBasedOnTierPriceQty795(this, 1)">
<span>1 can</span>
<span><span class="price">$4.69</span></span>
<span>(<span class="price">$4.69</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-795" onclick="updateQtyBasedOnTierPriceQty795(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="42.2" data-price-type="" class="price-wrapper "><span class="price">$42.20</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="4.22" data-price-type="" class="price-wrapper "><span class="price">$4.22</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-795" onclick="updateQtyBasedOnTierPriceQty795(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="123.9" data-price-type="" class="price-wrapper "><span class="price">$123.90</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="4.13" data-price-type="" class="price-wrapper "><span class="price">$4.13</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-795" onclick="updateQtyBasedOnTierPriceQty795(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="241.8" data-price-type="" class="price-wrapper "><span class="price">$241.80</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="4.03" data-price-type="" class="price-wrapper "><span class="price">$4.03</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-795" onclick="updateQtyBasedOnTierPriceQty795(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="394" data-price-type="" class="price-wrapper "><span class="price">$394.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="3.94" data-price-type="" class="price-wrapper "><span class="price">$3.94</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-795" onchange="updateQtyBasedOnTierPriceQty795(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice795() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.69,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "164174",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "795",
"website_price": 4.22,
"price_incl_tax": 4.22,
"price_excl_tax": 4.22
}, {
"price_id": "164738",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "795",
"website_price": 4.13,
"price_incl_tax": 4.13,
"price_excl_tax": 4.13
}, {
"price_id": "165302",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "795",
"website_price": 4.03,
"price_incl_tax": 4.03,
"price_excl_tax": 4.03
}, {
"price_id": "165866",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "795",
"website_price": 3.94,
"price_incl_tax": 3.94,
"price_excl_tax": 3.94
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-795.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-795.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice795()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-795" id="product-save-price-795">
</span>
<span class="sd-price-without-discount-amount product-wod-price-795" id="product-wod-price-795">
</span>
<span class="price-label block"> </span>
<span id="product-price-795" class="sd-unit-price product-price-795">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.69</span> </span> / can </span>
<meta itemprop="price" content="4.69">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-795" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-795" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.69</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-795" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-795" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField795 !== 'function') {
function initQtyField795() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '795',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField795()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[795]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[795]" form="product_addtocart_form795" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[795] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-795', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form795" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/808/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/808/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form808">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="808">
<a href="https://snusdaddy.com/r4ve-merry-cherry-10-mg" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-808.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/m/e/merry_cherry_10_460x460.png" loading="lazy" width="240" height="300" alt="R4VE Merry Cherry 10 mg Product Label" title="R4VE Merry Cherry 10 mg Product Label">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> R4VE <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 5 </div>
<div class="sd-star-green"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/r4ve-merry-cherry-10-mg" :id="`slide-desc-808-${$id('slider-id')}`" id="slide-desc-808-slider-id-19">
Merry Cherry 10 mg </a>
</div>
<div class="mg-per-pouch"> 5 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty808 !== 'function') {
function updateQtyBasedOnTierPriceQty808(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-808');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[808]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-808');
const priceWods = document.getElementsByClassName('product-wod-price-808');
const priceTotals = document.getElementsByClassName('sd-total-price-808');
const pricePerCans = document.getElementsByClassName('product-price-808');
let savePrice = 0;
let customTotalsPrice = 4.19;
var customPerItemPrice = 4.19;
if (qty >= 10) {
savePrice = qty * 0.42;
customTotalsPrice = parseFloat("3.77") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.77;
}
if (qty >= 30) {
savePrice = qty * 0.5;
customTotalsPrice = parseFloat("3.69") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.69;
}
if (qty >= 60) {
savePrice = qty * 0.59;
customTotalsPrice = parseFloat("3.6") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.6;
}
if (qty >= 100) {
savePrice = qty * 0.67;
customTotalsPrice = parseFloat("3.52") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.52;
}
// Calculate the price
const wodPrice = qty * 4.19;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.19);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.19)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-808 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-808" onclick="updateQtyBasedOnTierPriceQty808(this, 1)">
<span>1 can</span>
<span><span class="price">$4.19</span></span>
<span>(<span class="price">$4.19</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-808" onclick="updateQtyBasedOnTierPriceQty808(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="37.7" data-price-type="" class="price-wrapper "><span class="price">$37.70</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="3.77" data-price-type="" class="price-wrapper "><span class="price">$3.77</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-808" onclick="updateQtyBasedOnTierPriceQty808(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="110.7" data-price-type="" class="price-wrapper "><span class="price">$110.70</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="3.69" data-price-type="" class="price-wrapper "><span class="price">$3.69</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-808" onclick="updateQtyBasedOnTierPriceQty808(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="216" data-price-type="" class="price-wrapper "><span class="price">$216.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="3.6" data-price-type="" class="price-wrapper "><span class="price">$3.60</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-808" onclick="updateQtyBasedOnTierPriceQty808(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="352" data-price-type="" class="price-wrapper "><span class="price">$352.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="3.52" data-price-type="" class="price-wrapper "><span class="price">$3.52</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-808" onchange="updateQtyBasedOnTierPriceQty808(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice808() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.19,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "174527",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "808",
"website_price": 3.77,
"price_incl_tax": 3.77,
"price_excl_tax": 3.77
}, {
"price_id": "174531",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "808",
"website_price": 3.69,
"price_incl_tax": 3.69,
"price_excl_tax": 3.69
}, {
"price_id": "174535",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "808",
"website_price": 3.6,
"price_incl_tax": 3.6,
"price_excl_tax": 3.6
}, {
"price_id": "174539",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "808",
"website_price": 3.52,
"price_incl_tax": 3.52,
"price_excl_tax": 3.52
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-808.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-808.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice808()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-808" id="product-save-price-808">
</span>
<span class="sd-price-without-discount-amount product-wod-price-808" id="product-wod-price-808">
</span>
<span class="price-label block"> </span>
<span id="product-price-808" class="sd-unit-price product-price-808">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.19</span> </span> / can </span>
<meta itemprop="price" content="4.19">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-808" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-808" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.19</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-808" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-808" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField808 !== 'function') {
function initQtyField808() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '808',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField808()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[808]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[808]" form="product_addtocart_form808" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[808] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-808', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form808" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/809/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/809/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form809">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="809">
<a href="https://snusdaddy.com/r4ve-merry-cherry-30-mg" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-809.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/m/e/merry_cherry_30_460x460.png" loading="lazy" width="240" height="300" alt="R4VE Merry Cherry 30 mg Product Label" title="R4VE Merry Cherry 30 mg Product Label">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> R4VE <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/r4ve-merry-cherry-30-mg" :id="`slide-desc-809-${$id('slider-id')}`" id="slide-desc-809-slider-id-20">
Merry Cherry 30 mg </a>
</div>
<div class="mg-per-pouch"> 15 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty809 !== 'function') {
function updateQtyBasedOnTierPriceQty809(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-809');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[809]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-809');
const priceWods = document.getElementsByClassName('product-wod-price-809');
const priceTotals = document.getElementsByClassName('sd-total-price-809');
const pricePerCans = document.getElementsByClassName('product-price-809');
let savePrice = 0;
let customTotalsPrice = 4.19;
var customPerItemPrice = 4.19;
if (qty >= 10) {
savePrice = qty * 0.42;
customTotalsPrice = parseFloat("3.77") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.77;
}
if (qty >= 30) {
savePrice = qty * 0.5;
customTotalsPrice = parseFloat("3.69") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.69;
}
if (qty >= 60) {
savePrice = qty * 0.59;
customTotalsPrice = parseFloat("3.6") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.6;
}
if (qty >= 100) {
savePrice = qty * 0.67;
customTotalsPrice = parseFloat("3.52") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.52;
}
// Calculate the price
const wodPrice = qty * 4.19;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.19);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.19)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-809 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-809" onclick="updateQtyBasedOnTierPriceQty809(this, 1)">
<span>1 can</span>
<span><span class="price">$4.19</span></span>
<span>(<span class="price">$4.19</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-809" onclick="updateQtyBasedOnTierPriceQty809(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="37.7" data-price-type="" class="price-wrapper "><span class="price">$37.70</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="3.77" data-price-type="" class="price-wrapper "><span class="price">$3.77</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-809" onclick="updateQtyBasedOnTierPriceQty809(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="110.7" data-price-type="" class="price-wrapper "><span class="price">$110.70</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="3.69" data-price-type="" class="price-wrapper "><span class="price">$3.69</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-809" onclick="updateQtyBasedOnTierPriceQty809(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="216" data-price-type="" class="price-wrapper "><span class="price">$216.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="3.6" data-price-type="" class="price-wrapper "><span class="price">$3.60</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-809" onclick="updateQtyBasedOnTierPriceQty809(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="352" data-price-type="" class="price-wrapper "><span class="price">$352.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="3.52" data-price-type="" class="price-wrapper "><span class="price">$3.52</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-809" onchange="updateQtyBasedOnTierPriceQty809(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice809() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.19,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "174559",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "809",
"website_price": 3.77,
"price_incl_tax": 3.77,
"price_excl_tax": 3.77
}, {
"price_id": "174563",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "809",
"website_price": 3.69,
"price_incl_tax": 3.69,
"price_excl_tax": 3.69
}, {
"price_id": "174567",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "809",
"website_price": 3.6,
"price_incl_tax": 3.6,
"price_excl_tax": 3.6
}, {
"price_id": "174571",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "809",
"website_price": 3.52,
"price_incl_tax": 3.52,
"price_excl_tax": 3.52
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-809.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-809.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice809()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-809" id="product-save-price-809">
</span>
<span class="sd-price-without-discount-amount product-wod-price-809" id="product-wod-price-809">
</span>
<span class="price-label block"> </span>
<span id="product-price-809" class="sd-unit-price product-price-809">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.19</span> </span> / can </span>
<meta itemprop="price" content="4.19">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-809" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-809" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.19</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-809" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-809" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField809 !== 'function') {
function initQtyField809() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '809',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField809()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[809]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[809]" form="product_addtocart_form809" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[809] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-809', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form809" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/843/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/843/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form843">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="843">
<a href="https://snusdaddy.com/iceberg-cherry" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-843.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/c/h/cherry_460x460_1.png" loading="lazy" width="240" height="300" alt="Iceberg Cherry Product Label" title="Iceberg Cherry Product Label">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> Iceberg <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/iceberg-cherry" :id="`slide-desc-843-${$id('slider-id')}`" id="slide-desc-843-slider-id-21">
Cherry </a>
</div>
<div class="mg-per-pouch"> 35 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty843 !== 'function') {
function updateQtyBasedOnTierPriceQty843(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-843');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[843]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-843');
const priceWods = document.getElementsByClassName('product-wod-price-843');
const priceTotals = document.getElementsByClassName('sd-total-price-843');
const pricePerCans = document.getElementsByClassName('product-price-843');
let savePrice = 0;
let customTotalsPrice = 4.69;
var customPerItemPrice = 4.69;
if (qty >= 10) {
savePrice = qty * 0.47;
customTotalsPrice = parseFloat("4.22") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.22;
}
if (qty >= 30) {
savePrice = qty * 0.56;
customTotalsPrice = parseFloat("4.13") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.13;
}
if (qty >= 60) {
savePrice = qty * 0.66;
customTotalsPrice = parseFloat("4.03") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.03;
}
if (qty >= 100) {
savePrice = qty * 0.75;
customTotalsPrice = parseFloat("3.94") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.94;
}
// Calculate the price
const wodPrice = qty * 4.69;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.69);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.69)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-843 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-843" onclick="updateQtyBasedOnTierPriceQty843(this, 1)">
<span>1 can</span>
<span><span class="price">$4.69</span></span>
<span>(<span class="price">$4.69</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-843" onclick="updateQtyBasedOnTierPriceQty843(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="42.2" data-price-type="" class="price-wrapper "><span class="price">$42.20</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="4.22" data-price-type="" class="price-wrapper "><span class="price">$4.22</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-843" onclick="updateQtyBasedOnTierPriceQty843(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="123.9" data-price-type="" class="price-wrapper "><span class="price">$123.90</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="4.13" data-price-type="" class="price-wrapper "><span class="price">$4.13</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-843" onclick="updateQtyBasedOnTierPriceQty843(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="241.8" data-price-type="" class="price-wrapper "><span class="price">$241.80</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="4.03" data-price-type="" class="price-wrapper "><span class="price">$4.03</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-843" onclick="updateQtyBasedOnTierPriceQty843(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="394" data-price-type="" class="price-wrapper "><span class="price">$394.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="3.94" data-price-type="" class="price-wrapper "><span class="price">$3.94</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-843" onchange="updateQtyBasedOnTierPriceQty843(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice843() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.69,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "163789",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "843",
"website_price": 4.22,
"price_incl_tax": 4.22,
"price_excl_tax": 4.22
}, {
"price_id": "164353",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "843",
"website_price": 4.13,
"price_incl_tax": 4.13,
"price_excl_tax": 4.13
}, {
"price_id": "164917",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "843",
"website_price": 4.03,
"price_incl_tax": 4.03,
"price_excl_tax": 4.03
}, {
"price_id": "165481",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "843",
"website_price": 3.94,
"price_incl_tax": 3.94,
"price_excl_tax": 3.94
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-843.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-843.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice843()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-843" id="product-save-price-843">
</span>
<span class="sd-price-without-discount-amount product-wod-price-843" id="product-wod-price-843">
</span>
<span class="price-label block"> </span>
<span id="product-price-843" class="sd-unit-price product-price-843">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.69</span> </span> / can </span>
<meta itemprop="price" content="4.69">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-843" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-843" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.69</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-843" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-843" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField843 !== 'function') {
function initQtyField843() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '843',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField843()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[843]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[843]" form="product_addtocart_form843" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[843] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-843', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form843" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/850/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/850/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form850">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="850">
<a href="https://snusdaddy.com/cuba-black-cherry-slim" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-850.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/c/h/cherry_460x460_2.png" loading="lazy" width="240" height="300" alt="CUBA Black Cherry Slim Product Label" title="CUBA Black Cherry Slim Product Label">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> CUBA <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/cuba-black-cherry-slim" :id="`slide-desc-850-${$id('slider-id')}`" id="slide-desc-850-slider-id-22">
Black Cherry </a>
</div>
<div class="mg-per-pouch"> 42.9 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty850 !== 'function') {
function updateQtyBasedOnTierPriceQty850(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-850');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[850]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-850');
const priceWods = document.getElementsByClassName('product-wod-price-850');
const priceTotals = document.getElementsByClassName('sd-total-price-850');
const pricePerCans = document.getElementsByClassName('product-price-850');
let savePrice = 0;
let customTotalsPrice = 4.89;
var customPerItemPrice = 4.89;
if (qty >= 10) {
savePrice = qty * 0.49;
customTotalsPrice = parseFloat("4.4") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.4;
}
if (qty >= 30) {
savePrice = qty * 0.59;
customTotalsPrice = parseFloat("4.3") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.3;
}
if (qty >= 60) {
savePrice = qty * 0.68;
customTotalsPrice = parseFloat("4.21") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.21;
}
if (qty >= 100) {
savePrice = qty * 0.78;
customTotalsPrice = parseFloat("4.11") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.11;
}
// Calculate the price
const wodPrice = qty * 4.89;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.89);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.89)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-850 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-850" onclick="updateQtyBasedOnTierPriceQty850(this, 1)">
<span>1 can</span>
<span><span class="price">$4.89</span></span>
<span>(<span class="price">$4.89</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-850" onclick="updateQtyBasedOnTierPriceQty850(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="44" data-price-type="" class="price-wrapper "><span class="price">$44.00</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="4.4" data-price-type="" class="price-wrapper "><span class="price">$4.40</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-850" onclick="updateQtyBasedOnTierPriceQty850(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="129" data-price-type="" class="price-wrapper "><span class="price">$129.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="4.3" data-price-type="" class="price-wrapper "><span class="price">$4.30</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-850" onclick="updateQtyBasedOnTierPriceQty850(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="252.6" data-price-type="" class="price-wrapper "><span class="price">$252.60</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="4.21" data-price-type="" class="price-wrapper "><span class="price">$4.21</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-850" onclick="updateQtyBasedOnTierPriceQty850(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="411" data-price-type="" class="price-wrapper "><span class="price">$411.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="4.11" data-price-type="" class="price-wrapper "><span class="price">$4.11</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-850" onchange="updateQtyBasedOnTierPriceQty850(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice850() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.89,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "163737",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "850",
"website_price": 4.4,
"price_incl_tax": 4.4,
"price_excl_tax": 4.4
}, {
"price_id": "164301",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "850",
"website_price": 4.3,
"price_incl_tax": 4.3,
"price_excl_tax": 4.3
}, {
"price_id": "164865",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "850",
"website_price": 4.21,
"price_incl_tax": 4.21,
"price_excl_tax": 4.21
}, {
"price_id": "165429",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "850",
"website_price": 4.11,
"price_incl_tax": 4.11,
"price_excl_tax": 4.11
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-850.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-850.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice850()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-850" id="product-save-price-850">
</span>
<span class="sd-price-without-discount-amount product-wod-price-850" id="product-wod-price-850">
</span>
<span class="price-label block"> </span>
<span id="product-price-850" class="sd-unit-price product-price-850">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.89</span> </span> / can </span>
<meta itemprop="price" content="4.89">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-850" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-850" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.89</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-850" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-850" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField850 !== 'function') {
function initQtyField850() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '850',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField850()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[850]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[850]" form="product_addtocart_form850" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[850] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-850', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form850" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/868/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/868/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form868">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="868">
<a href="https://snusdaddy.com/r4ve-minty-berry-50-mg" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-868.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/m/i/minty_berry_50_460x460.png" loading="lazy" width="240" height="300" alt="R4VE Minty Berry 50 mg Product Label" title="R4VE Minty Berry 50 mg Product Label">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> R4VE <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/r4ve-minty-berry-50-mg" :id="`slide-desc-868-${$id('slider-id')}`" id="slide-desc-868-slider-id-23">
Minty Berry 50 mg </a>
</div>
<div class="mg-per-pouch"> 25 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty868 !== 'function') {
function updateQtyBasedOnTierPriceQty868(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-868');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[868]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-868');
const priceWods = document.getElementsByClassName('product-wod-price-868');
const priceTotals = document.getElementsByClassName('sd-total-price-868');
const pricePerCans = document.getElementsByClassName('product-price-868');
let savePrice = 0;
let customTotalsPrice = 4.19;
var customPerItemPrice = 4.19;
if (qty >= 10) {
savePrice = qty * 0.42;
customTotalsPrice = parseFloat("3.77") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.77;
}
if (qty >= 30) {
savePrice = qty * 0.5;
customTotalsPrice = parseFloat("3.69") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.69;
}
if (qty >= 60) {
savePrice = qty * 0.59;
customTotalsPrice = parseFloat("3.6") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.6;
}
if (qty >= 100) {
savePrice = qty * 0.67;
customTotalsPrice = parseFloat("3.52") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.52;
}
// Calculate the price
const wodPrice = qty * 4.19;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.19);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.19)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-868 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-868" onclick="updateQtyBasedOnTierPriceQty868(this, 1)">
<span>1 can</span>
<span><span class="price">$4.19</span></span>
<span>(<span class="price">$4.19</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-868" onclick="updateQtyBasedOnTierPriceQty868(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="37.7" data-price-type="" class="price-wrapper "><span class="price">$37.70</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="3.77" data-price-type="" class="price-wrapper "><span class="price">$3.77</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-868" onclick="updateQtyBasedOnTierPriceQty868(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="110.7" data-price-type="" class="price-wrapper "><span class="price">$110.70</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="3.69" data-price-type="" class="price-wrapper "><span class="price">$3.69</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-868" onclick="updateQtyBasedOnTierPriceQty868(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="216" data-price-type="" class="price-wrapper "><span class="price">$216.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="3.6" data-price-type="" class="price-wrapper "><span class="price">$3.60</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-868" onclick="updateQtyBasedOnTierPriceQty868(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="352" data-price-type="" class="price-wrapper "><span class="price">$352.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="3.52" data-price-type="" class="price-wrapper "><span class="price">$3.52</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-868" onchange="updateQtyBasedOnTierPriceQty868(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice868() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.19,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "174802",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "868",
"website_price": 3.77,
"price_incl_tax": 3.77,
"price_excl_tax": 3.77
}, {
"price_id": "174806",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "868",
"website_price": 3.69,
"price_incl_tax": 3.69,
"price_excl_tax": 3.69
}, {
"price_id": "174810",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "868",
"website_price": 3.6,
"price_incl_tax": 3.6,
"price_excl_tax": 3.6
}, {
"price_id": "174814",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "868",
"website_price": 3.52,
"price_incl_tax": 3.52,
"price_excl_tax": 3.52
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-868.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-868.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice868()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-868" id="product-save-price-868">
</span>
<span class="sd-price-without-discount-amount product-wod-price-868" id="product-wod-price-868">
</span>
<span class="price-label block"> </span>
<span id="product-price-868" class="sd-unit-price product-price-868">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.19</span> </span> / can </span>
<meta itemprop="price" content="4.19">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-868" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-868" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.19</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-868" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-868" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField868 !== 'function') {
function initQtyField868() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '868',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField868()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[868]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[868]" form="product_addtocart_form868" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[868] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-868', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form868" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/599/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/599/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form599">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="599">
<a href="https://snusdaddy.com/siberia-80-white-dry-slim-portion" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-599.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/-/8/-80_white_dry_slim_portion_460x460.png" loading="lazy" width="240" height="300" alt="Siberia -80 White Dry Slim Portion Product Label" title="Siberia -80 White Dry Slim Portion Product Label">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> Siberia <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/siberia-80-white-dry-slim-portion" :id="`slide-desc-599-${$id('slider-id')}`" id="slide-desc-599-slider-id-25">
-80 White Dry Slim Portion </a>
</div>
<div class="mg-per-pouch"> 28 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty599 !== 'function') {
function updateQtyBasedOnTierPriceQty599(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-599');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[599]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-599');
const priceWods = document.getElementsByClassName('product-wod-price-599');
const priceTotals = document.getElementsByClassName('sd-total-price-599');
const pricePerCans = document.getElementsByClassName('product-price-599');
let savePrice = 0;
let customTotalsPrice = 4.09;
var customPerItemPrice = 4.09;
if (qty >= 10) {
savePrice = qty * 0.41;
customTotalsPrice = parseFloat("3.68") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.68;
}
if (qty >= 30) {
savePrice = qty * 0.49;
customTotalsPrice = parseFloat("3.6") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.6;
}
if (qty >= 60) {
savePrice = qty * 0.57;
customTotalsPrice = parseFloat("3.52") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.52;
}
if (qty >= 100) {
savePrice = qty * 0.65;
customTotalsPrice = parseFloat("3.44") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.44;
}
// Calculate the price
const wodPrice = qty * 4.09;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.09);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.09)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-599 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-599" onclick="updateQtyBasedOnTierPriceQty599(this, 1)">
<span>1 can</span>
<span><span class="price">$4.09</span></span>
<span>(<span class="price">$4.09</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-599" onclick="updateQtyBasedOnTierPriceQty599(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="36.8" data-price-type="" class="price-wrapper "><span class="price">$36.80</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="3.68" data-price-type="" class="price-wrapper "><span class="price">$3.68</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-599" onclick="updateQtyBasedOnTierPriceQty599(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="108" data-price-type="" class="price-wrapper "><span class="price">$108.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="3.6" data-price-type="" class="price-wrapper "><span class="price">$3.60</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-599" onclick="updateQtyBasedOnTierPriceQty599(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="211.2" data-price-type="" class="price-wrapper "><span class="price">$211.20</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="3.52" data-price-type="" class="price-wrapper "><span class="price">$3.52</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-599" onclick="updateQtyBasedOnTierPriceQty599(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="344" data-price-type="" class="price-wrapper "><span class="price">$344.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="3.44" data-price-type="" class="price-wrapper "><span class="price">$3.44</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-599" onchange="updateQtyBasedOnTierPriceQty599(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice599() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.09,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "157475",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "599",
"website_price": 3.68,
"price_incl_tax": 3.68,
"price_excl_tax": 3.68
}, {
"price_id": "158091",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "599",
"website_price": 3.6,
"price_incl_tax": 3.6,
"price_excl_tax": 3.6
}, {
"price_id": "158707",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "599",
"website_price": 3.52,
"price_incl_tax": 3.52,
"price_excl_tax": 3.52
}, {
"price_id": "159323",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "599",
"website_price": 3.44,
"price_incl_tax": 3.44,
"price_excl_tax": 3.44
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-599.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-599.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice599()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-599" id="product-save-price-599">
</span>
<span class="sd-price-without-discount-amount product-wod-price-599" id="product-wod-price-599">
</span>
<span class="price-label block"> </span>
<span id="product-price-599" class="sd-unit-price product-price-599">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.09</span> </span> / can </span>
<meta itemprop="price" content="4.09">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-599" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-599" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.09</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-599" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-599" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField599 !== 'function') {
function initQtyField599() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '599',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField599()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[599]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[599]" form="product_addtocart_form599" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[599] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-599', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form599" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/522/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/522/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form522">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="522">
<a href="https://snusdaddy.com/roda-lacket-loose" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-522.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/l/o/loose_460x460_5.png" loading="lazy" width="240" height="300" alt="Röda Lacket Loose Can" title="Röda Lacket Loose Can">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> Röda Lacket <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/roda-lacket-loose" :id="`slide-desc-522-${$id('slider-id')}`" id="slide-desc-522-slider-id-26">
Loose </a>
</div>
<div class="mg-per-pouch"> 7.9 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty522 !== 'function') {
function updateQtyBasedOnTierPriceQty522(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-522');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[522]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-522');
const priceWods = document.getElementsByClassName('product-wod-price-522');
const priceTotals = document.getElementsByClassName('sd-total-price-522');
const pricePerCans = document.getElementsByClassName('product-price-522');
let savePrice = 0;
let customTotalsPrice = 4.59;
var customPerItemPrice = 4.59;
if (qty >= 10) {
savePrice = qty * 0.46;
customTotalsPrice = parseFloat("4.13") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.13;
}
if (qty >= 30) {
savePrice = qty * 0.55;
customTotalsPrice = parseFloat("4.04") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.04;
}
if (qty >= 60) {
savePrice = qty * 0.64;
customTotalsPrice = parseFloat("3.95") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.95;
}
if (qty >= 100) {
savePrice = qty * 0.73;
customTotalsPrice = parseFloat("3.86") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.86;
}
// Calculate the price
const wodPrice = qty * 4.59;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.59);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.59)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-522 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-522" onclick="updateQtyBasedOnTierPriceQty522(this, 1)">
<span>1 can</span>
<span><span class="price">$4.59</span></span>
<span>(<span class="price">$4.59</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-522" onclick="updateQtyBasedOnTierPriceQty522(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="41.3" data-price-type="" class="price-wrapper "><span class="price">$41.30</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="4.13" data-price-type="" class="price-wrapper "><span class="price">$4.13</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-522" onclick="updateQtyBasedOnTierPriceQty522(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="121.2" data-price-type="" class="price-wrapper "><span class="price">$121.20</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="4.04" data-price-type="" class="price-wrapper "><span class="price">$4.04</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-522" onclick="updateQtyBasedOnTierPriceQty522(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="237" data-price-type="" class="price-wrapper "><span class="price">$237.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="3.95" data-price-type="" class="price-wrapper "><span class="price">$3.95</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-522" onclick="updateQtyBasedOnTierPriceQty522(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="386" data-price-type="" class="price-wrapper "><span class="price">$386.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="3.86" data-price-type="" class="price-wrapper "><span class="price">$3.86</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-522" onchange="updateQtyBasedOnTierPriceQty522(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice522() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.59,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "157465",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "522",
"website_price": 4.13,
"price_incl_tax": 4.13,
"price_excl_tax": 4.13
}, {
"price_id": "158081",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "522",
"website_price": 4.04,
"price_incl_tax": 4.04,
"price_excl_tax": 4.04
}, {
"price_id": "158697",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "522",
"website_price": 3.95,
"price_incl_tax": 3.95,
"price_excl_tax": 3.95
}, {
"price_id": "159313",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "522",
"website_price": 3.86,
"price_incl_tax": 3.86,
"price_excl_tax": 3.86
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-522.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-522.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice522()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-522" id="product-save-price-522">
</span>
<span class="sd-price-without-discount-amount product-wod-price-522" id="product-wod-price-522">
</span>
<span class="price-label block"> </span>
<span id="product-price-522" class="sd-unit-price product-price-522">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.59</span> </span> / can </span>
<meta itemprop="price" content="4.59">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-522" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-522" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.59</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-522" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-522" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField522 !== 'function') {
function initQtyField522() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '522',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField522()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[522]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[522]" form="product_addtocart_form522" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[522] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-522', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form522" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/393/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/393/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form393">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="393">
<a href="https://snusdaddy.com/lundgrens-skane-strong-white-portion" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-393.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/s/k/sk_ne_stark_460x460.png" loading="lazy" width="240" height="300" alt="Lundgrens Skåne Strong White Portion Product Label" title="Lundgrens Skåne Strong White Portion Product Label">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> Lundgrens <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/lundgrens-skane-strong-white-portion" :id="`slide-desc-393-${$id('slider-id')}`" id="slide-desc-393-slider-id-27">
Skåne Strong White Portion </a>
</div>
<div class="mg-per-pouch"> 15.1 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty393 !== 'function') {
function updateQtyBasedOnTierPriceQty393(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-393');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[393]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-393');
const priceWods = document.getElementsByClassName('product-wod-price-393');
const priceTotals = document.getElementsByClassName('sd-total-price-393');
const pricePerCans = document.getElementsByClassName('product-price-393');
let savePrice = 0;
let customTotalsPrice = 2.79;
var customPerItemPrice = 2.79;
if (qty >= 10) {
savePrice = qty * 0.28;
customTotalsPrice = parseFloat("2.51") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 2.51;
}
if (qty >= 30) {
savePrice = qty * 0.33;
customTotalsPrice = parseFloat("2.46") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 2.46;
}
if (qty >= 60) {
savePrice = qty * 0.39;
customTotalsPrice = parseFloat("2.4") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 2.4;
}
if (qty >= 100) {
savePrice = qty * 0.45;
customTotalsPrice = parseFloat("2.34") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 2.34;
}
// Calculate the price
const wodPrice = qty * 2.79;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 2.79);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 2.79)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-393 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-393" onclick="updateQtyBasedOnTierPriceQty393(this, 1)">
<span>1 can</span>
<span><span class="price">$2.79</span></span>
<span>(<span class="price">$2.79</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-393" onclick="updateQtyBasedOnTierPriceQty393(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="25.1" data-price-type="" class="price-wrapper "><span class="price">$25.10</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="2.51" data-price-type="" class="price-wrapper "><span class="price">$2.51</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-393" onclick="updateQtyBasedOnTierPriceQty393(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="73.8" data-price-type="" class="price-wrapper "><span class="price">$73.80</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="2.46" data-price-type="" class="price-wrapper "><span class="price">$2.46</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-393" onclick="updateQtyBasedOnTierPriceQty393(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="144" data-price-type="" class="price-wrapper "><span class="price">$144.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="2.4" data-price-type="" class="price-wrapper "><span class="price">$2.40</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-393" onclick="updateQtyBasedOnTierPriceQty393(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="234" data-price-type="" class="price-wrapper "><span class="price">$234.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="2.34" data-price-type="" class="price-wrapper "><span class="price">$2.34</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-393" onchange="updateQtyBasedOnTierPriceQty393(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice393() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 2.79,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "157421",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "393",
"website_price": 2.51,
"price_incl_tax": 2.51,
"price_excl_tax": 2.51
}, {
"price_id": "158037",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "393",
"website_price": 2.46,
"price_incl_tax": 2.46,
"price_excl_tax": 2.46
}, {
"price_id": "158653",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "393",
"website_price": 2.4,
"price_incl_tax": 2.4,
"price_excl_tax": 2.4
}, {
"price_id": "159269",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "393",
"website_price": 2.34,
"price_incl_tax": 2.34,
"price_excl_tax": 2.34
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-393.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-393.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice393()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-393" id="product-save-price-393">
</span>
<span class="sd-price-without-discount-amount product-wod-price-393" id="product-wod-price-393">
</span>
<span class="price-label block"> </span>
<span id="product-price-393" class="sd-unit-price product-price-393">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$2.79</span> </span> / can </span>
<meta itemprop="price" content="2.79">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-393" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-393" x-html="getFormattedFinalTotalPrice()">
<span class="price">$2.79</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-393" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-393" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField393 !== 'function') {
function initQtyField393() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '393',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField393()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[393]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[393]" form="product_addtocart_form393" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[393] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-393', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form393" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/148/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/148/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form148">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="148">
<a href="https://snusdaddy.com/siberia-80-white-portion" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-148.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/-/8/-80_white_portion_460x460.png" loading="lazy" width="240" height="300" alt="Siberia -80 White Portion Product Label" title="Siberia -80 White Portion Product Label">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> Siberia <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/siberia-80-white-portion" :id="`slide-desc-148-${$id('slider-id')}`" id="slide-desc-148-slider-id-28">
-80 White Portion </a>
</div>
<div class="mg-per-pouch"> 24 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty148 !== 'function') {
function updateQtyBasedOnTierPriceQty148(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-148');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[148]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-148');
const priceWods = document.getElementsByClassName('product-wod-price-148');
const priceTotals = document.getElementsByClassName('sd-total-price-148');
const pricePerCans = document.getElementsByClassName('product-price-148');
let savePrice = 0;
let customTotalsPrice = 4.39;
var customPerItemPrice = 4.39;
if (qty >= 10) {
savePrice = qty * 0.44;
customTotalsPrice = parseFloat("3.95") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.95;
}
if (qty >= 30) {
savePrice = qty * 0.53;
customTotalsPrice = parseFloat("3.86") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.86;
}
if (qty >= 60) {
savePrice = qty * 0.61;
customTotalsPrice = parseFloat("3.78") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.78;
}
if (qty >= 100) {
savePrice = qty * 0.7;
customTotalsPrice = parseFloat("3.69") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.69;
}
// Calculate the price
const wodPrice = qty * 4.39;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.39);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.39)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-148 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-148" onclick="updateQtyBasedOnTierPriceQty148(this, 1)">
<span>1 can</span>
<span><span class="price">$4.39</span></span>
<span>(<span class="price">$4.39</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-148" onclick="updateQtyBasedOnTierPriceQty148(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="39.5" data-price-type="" class="price-wrapper "><span class="price">$39.50</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="3.95" data-price-type="" class="price-wrapper "><span class="price">$3.95</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-148" onclick="updateQtyBasedOnTierPriceQty148(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="115.8" data-price-type="" class="price-wrapper "><span class="price">$115.80</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="3.86" data-price-type="" class="price-wrapper "><span class="price">$3.86</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-148" onclick="updateQtyBasedOnTierPriceQty148(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="226.8" data-price-type="" class="price-wrapper "><span class="price">$226.80</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="3.78" data-price-type="" class="price-wrapper "><span class="price">$3.78</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-148" onclick="updateQtyBasedOnTierPriceQty148(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="369" data-price-type="" class="price-wrapper "><span class="price">$369.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="3.69" data-price-type="" class="price-wrapper "><span class="price">$3.69</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-148" onchange="updateQtyBasedOnTierPriceQty148(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice148() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.39,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "157367",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "148",
"website_price": 3.95,
"price_incl_tax": 3.95,
"price_excl_tax": 3.95
}, {
"price_id": "157983",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "148",
"website_price": 3.86,
"price_incl_tax": 3.86,
"price_excl_tax": 3.86
}, {
"price_id": "158599",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "148",
"website_price": 3.78,
"price_incl_tax": 3.78,
"price_excl_tax": 3.78
}, {
"price_id": "159215",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "148",
"website_price": 3.69,
"price_incl_tax": 3.69,
"price_excl_tax": 3.69
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-148.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-148.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice148()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-148" id="product-save-price-148">
</span>
<span class="sd-price-without-discount-amount product-wod-price-148" id="product-wod-price-148">
</span>
<span class="price-label block"> </span>
<span id="product-price-148" class="sd-unit-price product-price-148">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.39</span> </span> / can </span>
<meta itemprop="price" content="4.39">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-148" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-148" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.39</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-148" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-148" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField148 !== 'function') {
function initQtyField148() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '148',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField148()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[148]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[148]" form="product_addtocart_form148" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[148] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-148', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form148" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/147/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/147/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form147">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="147">
<a href="https://snusdaddy.com/siberia-80-white-dry-portion" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-147.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/-/8/-80_white_dry_portion_460x460.png" loading="lazy" width="240" height="300" alt="Siberia -80 White Dry Portion Product Label" title="Siberia -80 White Dry Portion Product Label">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> Siberia <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 4.6 </div>
<div class="sd-star-green"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/siberia-80-white-dry-portion" :id="`slide-desc-147-${$id('slider-id')}`" id="slide-desc-147-slider-id-29">
-80 White Dry Portion </a>
</div>
<div class="mg-per-pouch"> 34.4 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty147 !== 'function') {
function updateQtyBasedOnTierPriceQty147(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-147');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[147]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-147');
const priceWods = document.getElementsByClassName('product-wod-price-147');
const priceTotals = document.getElementsByClassName('sd-total-price-147');
const pricePerCans = document.getElementsByClassName('product-price-147');
let savePrice = 0;
let customTotalsPrice = 4.39;
var customPerItemPrice = 4.39;
if (qty >= 10) {
savePrice = qty * 0.44;
customTotalsPrice = parseFloat("3.95") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.95;
}
if (qty >= 30) {
savePrice = qty * 0.53;
customTotalsPrice = parseFloat("3.86") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.86;
}
if (qty >= 60) {
savePrice = qty * 0.61;
customTotalsPrice = parseFloat("3.78") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.78;
}
if (qty >= 100) {
savePrice = qty * 0.7;
customTotalsPrice = parseFloat("3.69") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.69;
}
// Calculate the price
const wodPrice = qty * 4.39;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.39);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.39)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-147 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-147" onclick="updateQtyBasedOnTierPriceQty147(this, 1)">
<span>1 can</span>
<span><span class="price">$4.39</span></span>
<span>(<span class="price">$4.39</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-147" onclick="updateQtyBasedOnTierPriceQty147(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="39.5" data-price-type="" class="price-wrapper "><span class="price">$39.50</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="3.95" data-price-type="" class="price-wrapper "><span class="price">$3.95</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-147" onclick="updateQtyBasedOnTierPriceQty147(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="115.8" data-price-type="" class="price-wrapper "><span class="price">$115.80</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="3.86" data-price-type="" class="price-wrapper "><span class="price">$3.86</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-147" onclick="updateQtyBasedOnTierPriceQty147(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="226.8" data-price-type="" class="price-wrapper "><span class="price">$226.80</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="3.78" data-price-type="" class="price-wrapper "><span class="price">$3.78</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-147" onclick="updateQtyBasedOnTierPriceQty147(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="369" data-price-type="" class="price-wrapper "><span class="price">$369.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="3.69" data-price-type="" class="price-wrapper "><span class="price">$3.69</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-147" onchange="updateQtyBasedOnTierPriceQty147(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice147() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.39,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "157366",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "147",
"website_price": 3.95,
"price_incl_tax": 3.95,
"price_excl_tax": 3.95
}, {
"price_id": "157982",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "147",
"website_price": 3.86,
"price_incl_tax": 3.86,
"price_excl_tax": 3.86
}, {
"price_id": "158598",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "147",
"website_price": 3.78,
"price_incl_tax": 3.78,
"price_excl_tax": 3.78
}, {
"price_id": "159214",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "147",
"website_price": 3.69,
"price_incl_tax": 3.69,
"price_excl_tax": 3.69
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-147.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-147.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice147()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-147" id="product-save-price-147">
</span>
<span class="sd-price-without-discount-amount product-wod-price-147" id="product-wod-price-147">
</span>
<span class="price-label block"> </span>
<span id="product-price-147" class="sd-unit-price product-price-147">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.39</span> </span> / can </span>
<meta itemprop="price" content="4.39">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-147" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-147" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.39</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-147" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-147" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField147 !== 'function') {
function initQtyField147() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '147',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField147()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[147]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[147]" form="product_addtocart_form147" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[147] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-147', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form147" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/145/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/145/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form145">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="145">
<a href="https://snusdaddy.com/oden-s-cold-extreme-white-dry-portion" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-145.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/c/o/cold_dry_460x460.png" loading="lazy" width="240" height="300" alt="Odens Cold Extreme White Dry Portion Product Label" title="Odens Cold Extreme White Dry Portion Product Label">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> Oden's <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 4 </div>
<div class="sd-star-light-green"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/oden-s-cold-extreme-white-dry-portion" :id="`slide-desc-145-${$id('slider-id')}`" id="slide-desc-145-slider-id-30">
Cold Extreme White Dry Portion </a>
</div>
<div class="mg-per-pouch"> 17.6 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty145 !== 'function') {
function updateQtyBasedOnTierPriceQty145(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-145');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[145]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-145');
const priceWods = document.getElementsByClassName('product-wod-price-145');
const priceTotals = document.getElementsByClassName('sd-total-price-145');
const pricePerCans = document.getElementsByClassName('product-price-145');
let savePrice = 0;
let customTotalsPrice = 3.49;
var customPerItemPrice = 3.49;
if (qty >= 10) {
savePrice = qty * 0.35;
customTotalsPrice = parseFloat("3.14") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.14;
}
if (qty >= 30) {
savePrice = qty * 0.42;
customTotalsPrice = parseFloat("3.07") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.07;
}
if (qty >= 60) {
savePrice = qty * 0.49;
customTotalsPrice = parseFloat("3") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3;
}
if (qty >= 100) {
savePrice = qty * 0.56;
customTotalsPrice = parseFloat("2.93") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 2.93;
}
// Calculate the price
const wodPrice = qty * 3.49;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 3.49);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 3.49)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-145 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-145" onclick="updateQtyBasedOnTierPriceQty145(this, 1)">
<span>1 can</span>
<span><span class="price">$3.49</span></span>
<span>(<span class="price">$3.49</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-145" onclick="updateQtyBasedOnTierPriceQty145(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="31.4" data-price-type="" class="price-wrapper "><span class="price">$31.40</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="3.14" data-price-type="" class="price-wrapper "><span class="price">$3.14</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-145" onclick="updateQtyBasedOnTierPriceQty145(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="92.1" data-price-type="" class="price-wrapper "><span class="price">$92.10</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="3.07" data-price-type="" class="price-wrapper "><span class="price">$3.07</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-145" onclick="updateQtyBasedOnTierPriceQty145(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="180" data-price-type="" class="price-wrapper "><span class="price">$180.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="3" data-price-type="" class="price-wrapper "><span class="price">$3.00</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-145" onclick="updateQtyBasedOnTierPriceQty145(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="293" data-price-type="" class="price-wrapper "><span class="price">$293.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="2.93" data-price-type="" class="price-wrapper "><span class="price">$2.93</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-145" onchange="updateQtyBasedOnTierPriceQty145(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice145() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 3.49,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "157364",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "145",
"website_price": 3.14,
"price_incl_tax": 3.14,
"price_excl_tax": 3.14
}, {
"price_id": "157980",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "145",
"website_price": 3.07,
"price_incl_tax": 3.07,
"price_excl_tax": 3.07
}, {
"price_id": "158596",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "145",
"website_price": 3,
"price_incl_tax": 3,
"price_excl_tax": 3
}, {
"price_id": "159212",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "145",
"website_price": 2.93,
"price_incl_tax": 2.93,
"price_excl_tax": 2.93
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-145.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-145.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice145()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-145" id="product-save-price-145">
</span>
<span class="sd-price-without-discount-amount product-wod-price-145" id="product-wod-price-145">
</span>
<span class="price-label block"> </span>
<span id="product-price-145" class="sd-unit-price product-price-145">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$3.49</span> </span> / can </span>
<meta itemprop="price" content="3.49">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-145" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-145" x-html="getFormattedFinalTotalPrice()">
<span class="price">$3.49</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-145" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-145" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField145 !== 'function') {
function initQtyField145() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '145',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField145()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[145]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[145]" form="product_addtocart_form145" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[145] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-145', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form145" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/72/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/72/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form72">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="72">
<a href="https://snusdaddy.com/nick-johnny-americana-portion-extra-strong" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-72.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/a/m/americana_460x460.png" loading="lazy" width="240" height="300" alt="Nick and Johnny Americana Portion Extra Strong Product Label" title="Nick and Johnny Americana Portion Extra Strong Product Label">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> Nick & Johnny <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/nick-johnny-americana-portion-extra-strong" :id="`slide-desc-72-${$id('slider-id')}`" id="slide-desc-72-slider-id-31">
Americana Portion Extra Strong </a>
</div>
<div class="mg-per-pouch"> 16.5 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty72 !== 'function') {
function updateQtyBasedOnTierPriceQty72(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-72');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[72]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-72');
const priceWods = document.getElementsByClassName('product-wod-price-72');
const priceTotals = document.getElementsByClassName('sd-total-price-72');
const pricePerCans = document.getElementsByClassName('product-price-72');
let savePrice = 0;
let customTotalsPrice = 4.39;
var customPerItemPrice = 4.39;
if (qty >= 10) {
savePrice = qty * 0.44;
customTotalsPrice = parseFloat("3.95") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.95;
}
if (qty >= 30) {
savePrice = qty * 0.53;
customTotalsPrice = parseFloat("3.86") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.86;
}
if (qty >= 60) {
savePrice = qty * 0.61;
customTotalsPrice = parseFloat("3.78") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.78;
}
if (qty >= 100) {
savePrice = qty * 0.7;
customTotalsPrice = parseFloat("3.69") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.69;
}
// Calculate the price
const wodPrice = qty * 4.39;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.39);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.39)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-72 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-72" onclick="updateQtyBasedOnTierPriceQty72(this, 1)">
<span>1 can</span>
<span><span class="price">$4.39</span></span>
<span>(<span class="price">$4.39</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-72" onclick="updateQtyBasedOnTierPriceQty72(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="39.5" data-price-type="" class="price-wrapper "><span class="price">$39.50</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="3.95" data-price-type="" class="price-wrapper "><span class="price">$3.95</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-72" onclick="updateQtyBasedOnTierPriceQty72(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="115.8" data-price-type="" class="price-wrapper "><span class="price">$115.80</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="3.86" data-price-type="" class="price-wrapper "><span class="price">$3.86</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-72" onclick="updateQtyBasedOnTierPriceQty72(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="226.8" data-price-type="" class="price-wrapper "><span class="price">$226.80</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="3.78" data-price-type="" class="price-wrapper "><span class="price">$3.78</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-72" onclick="updateQtyBasedOnTierPriceQty72(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="369" data-price-type="" class="price-wrapper "><span class="price">$369.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="3.69" data-price-type="" class="price-wrapper "><span class="price">$3.69</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-72" onchange="updateQtyBasedOnTierPriceQty72(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice72() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.39,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "157322",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "72",
"website_price": 3.95,
"price_incl_tax": 3.95,
"price_excl_tax": 3.95
}, {
"price_id": "157938",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "72",
"website_price": 3.86,
"price_incl_tax": 3.86,
"price_excl_tax": 3.86
}, {
"price_id": "158554",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "72",
"website_price": 3.78,
"price_incl_tax": 3.78,
"price_excl_tax": 3.78
}, {
"price_id": "159170",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "72",
"website_price": 3.69,
"price_incl_tax": 3.69,
"price_excl_tax": 3.69
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-72.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-72.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice72()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-72" id="product-save-price-72">
</span>
<span class="sd-price-without-discount-amount product-wod-price-72" id="product-wod-price-72">
</span>
<span class="price-label block"> </span>
<span id="product-price-72" class="sd-unit-price product-price-72">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.39</span> </span> / can </span>
<meta itemprop="price" content="4.39">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-72" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-72" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.39</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-72" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-72" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField72 !== 'function') {
function initQtyField72() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '72',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField72()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[72]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[72]" form="product_addtocart_form72" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[72] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-72', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form72" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/62/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/62/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form62">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="62">
<a href="https://snusdaddy.com/the-lab-06-slim-portion-extra-strong" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-62.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/0/6/06_460x460.png" loading="lazy" width="240" height="300" alt="The Lab 06 Slim Portion Extra Strong snus can at Snusdaddy.com" title="The Lab 06 Slim Portion Extra Strong snus can at Snusdaddy.com">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> The Lab <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/the-lab-06-slim-portion-extra-strong" :id="`slide-desc-62-${$id('slider-id')}`" id="slide-desc-62-slider-id-32">
06 Slim Portion Extra Strong </a>
</div>
<div class="mg-per-pouch"> 18 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty62 !== 'function') {
function updateQtyBasedOnTierPriceQty62(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-62');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[62]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-62');
const priceWods = document.getElementsByClassName('product-wod-price-62');
const priceTotals = document.getElementsByClassName('sd-total-price-62');
const pricePerCans = document.getElementsByClassName('product-price-62');
let savePrice = 0;
let customTotalsPrice = 4.29;
var customPerItemPrice = 4.29;
if (qty >= 10) {
savePrice = qty * 0.43;
customTotalsPrice = parseFloat("3.86") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.86;
}
if (qty >= 30) {
savePrice = qty * 0.51;
customTotalsPrice = parseFloat("3.78") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.78;
}
if (qty >= 60) {
savePrice = qty * 0.6;
customTotalsPrice = parseFloat("3.69") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.69;
}
if (qty >= 100) {
savePrice = qty * 0.69;
customTotalsPrice = parseFloat("3.6") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.6;
}
// Calculate the price
const wodPrice = qty * 4.29;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.29);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.29)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-62 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-62" onclick="updateQtyBasedOnTierPriceQty62(this, 1)">
<span>1 can</span>
<span><span class="price">$4.29</span></span>
<span>(<span class="price">$4.29</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-62" onclick="updateQtyBasedOnTierPriceQty62(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="38.6" data-price-type="" class="price-wrapper "><span class="price">$38.60</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="3.86" data-price-type="" class="price-wrapper "><span class="price">$3.86</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-62" onclick="updateQtyBasedOnTierPriceQty62(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="113.4" data-price-type="" class="price-wrapper "><span class="price">$113.40</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="3.78" data-price-type="" class="price-wrapper "><span class="price">$3.78</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-62" onclick="updateQtyBasedOnTierPriceQty62(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="221.4" data-price-type="" class="price-wrapper "><span class="price">$221.40</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="3.69" data-price-type="" class="price-wrapper "><span class="price">$3.69</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-62" onclick="updateQtyBasedOnTierPriceQty62(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="360" data-price-type="" class="price-wrapper "><span class="price">$360.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="3.6" data-price-type="" class="price-wrapper "><span class="price">$3.60</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-62" onchange="updateQtyBasedOnTierPriceQty62(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice62() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.29,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "157312",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "62",
"website_price": 3.86,
"price_incl_tax": 3.86,
"price_excl_tax": 3.86
}, {
"price_id": "157928",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "62",
"website_price": 3.78,
"price_incl_tax": 3.78,
"price_excl_tax": 3.78
}, {
"price_id": "158544",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "62",
"website_price": 3.69,
"price_incl_tax": 3.69,
"price_excl_tax": 3.69
}, {
"price_id": "159160",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "62",
"website_price": 3.6,
"price_incl_tax": 3.6,
"price_excl_tax": 3.6
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-62.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-62.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice62()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-62" id="product-save-price-62">
</span>
<span class="sd-price-without-discount-amount product-wod-price-62" id="product-wod-price-62">
</span>
<span class="price-label block"> </span>
<span id="product-price-62" class="sd-unit-price product-price-62">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.29</span> </span> / can </span>
<meta itemprop="price" content="4.29">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-62" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-62" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.29</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-62" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-62" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField62 !== 'function') {
function initQtyField62() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '62',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField62()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[62]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[62]" form="product_addtocart_form62" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[62] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-62', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form62" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/59/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/59/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form59">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="59">
<a href="https://snusdaddy.com/goteborgs-rape-original-portion" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-59.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/p/o/portion_460x460_1.png" loading="lazy" width="240" height="300" alt="Göteborgs Rapé Original Portion snus can at Snusdaddy.com" title="Göteborgs Rapé Original Portion snus can at Snusdaddy.com">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> Göteborgs Rapé <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/goteborgs-rape-original-portion" :id="`slide-desc-59-${$id('slider-id')}`" id="slide-desc-59-slider-id-33">
Original Portion </a>
</div>
<div class="mg-per-pouch"> 9.5 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty59 !== 'function') {
function updateQtyBasedOnTierPriceQty59(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-59');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[59]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-59');
const priceWods = document.getElementsByClassName('product-wod-price-59');
const priceTotals = document.getElementsByClassName('sd-total-price-59');
const pricePerCans = document.getElementsByClassName('product-price-59');
let savePrice = 0;
let customTotalsPrice = 4.19;
var customPerItemPrice = 4.19;
if (qty >= 10) {
savePrice = qty * 0.42;
customTotalsPrice = parseFloat("3.77") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.77;
}
if (qty >= 30) {
savePrice = qty * 0.5;
customTotalsPrice = parseFloat("3.69") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.69;
}
if (qty >= 60) {
savePrice = qty * 0.59;
customTotalsPrice = parseFloat("3.6") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.6;
}
if (qty >= 100) {
savePrice = qty * 0.67;
customTotalsPrice = parseFloat("3.52") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.52;
}
// Calculate the price
const wodPrice = qty * 4.19;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.19);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.19)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-59 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-59" onclick="updateQtyBasedOnTierPriceQty59(this, 1)">
<span>1 can</span>
<span><span class="price">$4.19</span></span>
<span>(<span class="price">$4.19</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-59" onclick="updateQtyBasedOnTierPriceQty59(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="37.7" data-price-type="" class="price-wrapper "><span class="price">$37.70</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="3.77" data-price-type="" class="price-wrapper "><span class="price">$3.77</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-59" onclick="updateQtyBasedOnTierPriceQty59(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="110.7" data-price-type="" class="price-wrapper "><span class="price">$110.70</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="3.69" data-price-type="" class="price-wrapper "><span class="price">$3.69</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-59" onclick="updateQtyBasedOnTierPriceQty59(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="216" data-price-type="" class="price-wrapper "><span class="price">$216.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="3.6" data-price-type="" class="price-wrapper "><span class="price">$3.60</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-59" onclick="updateQtyBasedOnTierPriceQty59(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="352" data-price-type="" class="price-wrapper "><span class="price">$352.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="3.52" data-price-type="" class="price-wrapper "><span class="price">$3.52</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-59" onchange="updateQtyBasedOnTierPriceQty59(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice59() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.19,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "157309",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "59",
"website_price": 3.77,
"price_incl_tax": 3.77,
"price_excl_tax": 3.77
}, {
"price_id": "157925",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "59",
"website_price": 3.69,
"price_incl_tax": 3.69,
"price_excl_tax": 3.69
}, {
"price_id": "158541",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "59",
"website_price": 3.6,
"price_incl_tax": 3.6,
"price_excl_tax": 3.6
}, {
"price_id": "159157",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "59",
"website_price": 3.52,
"price_incl_tax": 3.52,
"price_excl_tax": 3.52
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-59.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-59.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice59()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-59" id="product-save-price-59">
</span>
<span class="sd-price-without-discount-amount product-wod-price-59" id="product-wod-price-59">
</span>
<span class="price-label block"> </span>
<span id="product-price-59" class="sd-unit-price product-price-59">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.19</span> </span> / can </span>
<meta itemprop="price" content="4.19">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-59" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-59" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.19</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-59" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-59" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField59 !== 'function') {
function initQtyField59() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '59',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField59()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[59]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[59]" form="product_addtocart_form59" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[59] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-59', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form59" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/52/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/52/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form52">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="52">
<a href="https://snusdaddy.com/general-original-portion-extra-strong" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-52.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/p/o/portion_extra_strong_460x460.png" loading="lazy" width="240" height="300" alt="General Original Portion Extra Strong snus can at Snusdaddy.com" title="General Original Portion Extra Strong snus can at Snusdaddy.com">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> General <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 5 </div>
<div class="sd-star-green"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/general-original-portion-extra-strong" :id="`slide-desc-52-${$id('slider-id')}`" id="slide-desc-52-slider-id-34">
Original Portion Extra Strong </a>
</div>
<div class="mg-per-pouch"> 15.5 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty52 !== 'function') {
function updateQtyBasedOnTierPriceQty52(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-52');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[52]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-52');
const priceWods = document.getElementsByClassName('product-wod-price-52');
const priceTotals = document.getElementsByClassName('sd-total-price-52');
const pricePerCans = document.getElementsByClassName('product-price-52');
let savePrice = 0;
let customTotalsPrice = 4.19;
var customPerItemPrice = 4.19;
if (qty >= 10) {
savePrice = qty * 0.42;
customTotalsPrice = parseFloat("3.77") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.77;
}
if (qty >= 30) {
savePrice = qty * 0.5;
customTotalsPrice = parseFloat("3.69") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.69;
}
if (qty >= 60) {
savePrice = qty * 0.59;
customTotalsPrice = parseFloat("3.6") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.6;
}
if (qty >= 100) {
savePrice = qty * 0.67;
customTotalsPrice = parseFloat("3.52") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.52;
}
// Calculate the price
const wodPrice = qty * 4.19;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.19);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.19)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-52 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-52" onclick="updateQtyBasedOnTierPriceQty52(this, 1)">
<span>1 can</span>
<span><span class="price">$4.19</span></span>
<span>(<span class="price">$4.19</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-52" onclick="updateQtyBasedOnTierPriceQty52(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="37.7" data-price-type="" class="price-wrapper "><span class="price">$37.70</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="3.77" data-price-type="" class="price-wrapper "><span class="price">$3.77</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-52" onclick="updateQtyBasedOnTierPriceQty52(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="110.7" data-price-type="" class="price-wrapper "><span class="price">$110.70</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="3.69" data-price-type="" class="price-wrapper "><span class="price">$3.69</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-52" onclick="updateQtyBasedOnTierPriceQty52(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="216" data-price-type="" class="price-wrapper "><span class="price">$216.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="3.6" data-price-type="" class="price-wrapper "><span class="price">$3.60</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-52" onclick="updateQtyBasedOnTierPriceQty52(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="352" data-price-type="" class="price-wrapper "><span class="price">$352.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="3.52" data-price-type="" class="price-wrapper "><span class="price">$3.52</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-52" onchange="updateQtyBasedOnTierPriceQty52(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice52() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.19,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "157302",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "52",
"website_price": 3.77,
"price_incl_tax": 3.77,
"price_excl_tax": 3.77
}, {
"price_id": "157918",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "52",
"website_price": 3.69,
"price_incl_tax": 3.69,
"price_excl_tax": 3.69
}, {
"price_id": "158534",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "52",
"website_price": 3.6,
"price_incl_tax": 3.6,
"price_excl_tax": 3.6
}, {
"price_id": "159150",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "52",
"website_price": 3.52,
"price_incl_tax": 3.52,
"price_excl_tax": 3.52
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-52.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-52.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice52()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-52" id="product-save-price-52">
</span>
<span class="sd-price-without-discount-amount product-wod-price-52" id="product-wod-price-52">
</span>
<span class="price-label block"> </span>
<span id="product-price-52" class="sd-unit-price product-price-52">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.19</span> </span> / can </span>
<meta itemprop="price" content="4.19">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-52" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-52" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.19</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-52" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-52" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField52 !== 'function') {
function initQtyField52() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '52',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField52()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[52]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[52]" form="product_addtocart_form52" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[52] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-52', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form52" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/29/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/29/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form29">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="29">
<a href="https://snusdaddy.com/ettan-white-portion" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-29.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/e/t/ettan_vit_460x460_1.png" loading="lazy" width="240" height="300" alt="Ettan White Portion snus can at Snusdaddy.com" title="Ettan White Portion snus can at Snusdaddy.com">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> Ettan <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 5 </div>
<div class="sd-star-green"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/ettan-white-portion" :id="`slide-desc-29-${$id('slider-id')}`" id="slide-desc-29-slider-id-35">
White Portion </a>
</div>
<div class="mg-per-pouch"> 7 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty29 !== 'function') {
function updateQtyBasedOnTierPriceQty29(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-29');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[29]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-29');
const priceWods = document.getElementsByClassName('product-wod-price-29');
const priceTotals = document.getElementsByClassName('sd-total-price-29');
const pricePerCans = document.getElementsByClassName('product-price-29');
let savePrice = 0;
let customTotalsPrice = 4.19;
var customPerItemPrice = 4.19;
if (qty >= 10) {
savePrice = qty * 0.42;
customTotalsPrice = parseFloat("3.77") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.77;
}
if (qty >= 30) {
savePrice = qty * 0.5;
customTotalsPrice = parseFloat("3.69") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.69;
}
if (qty >= 60) {
savePrice = qty * 0.59;
customTotalsPrice = parseFloat("3.6") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.6;
}
if (qty >= 100) {
savePrice = qty * 0.67;
customTotalsPrice = parseFloat("3.52") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.52;
}
// Calculate the price
const wodPrice = qty * 4.19;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.19);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.19)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-29 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-29" onclick="updateQtyBasedOnTierPriceQty29(this, 1)">
<span>1 can</span>
<span><span class="price">$4.19</span></span>
<span>(<span class="price">$4.19</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-29" onclick="updateQtyBasedOnTierPriceQty29(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="37.7" data-price-type="" class="price-wrapper "><span class="price">$37.70</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="3.77" data-price-type="" class="price-wrapper "><span class="price">$3.77</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-29" onclick="updateQtyBasedOnTierPriceQty29(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="110.7" data-price-type="" class="price-wrapper "><span class="price">$110.70</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="3.69" data-price-type="" class="price-wrapper "><span class="price">$3.69</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-29" onclick="updateQtyBasedOnTierPriceQty29(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="216" data-price-type="" class="price-wrapper "><span class="price">$216.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="3.6" data-price-type="" class="price-wrapper "><span class="price">$3.60</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-29" onclick="updateQtyBasedOnTierPriceQty29(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="352" data-price-type="" class="price-wrapper "><span class="price">$352.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="3.52" data-price-type="" class="price-wrapper "><span class="price">$3.52</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-29" onchange="updateQtyBasedOnTierPriceQty29(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice29() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.19,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "157279",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "29",
"website_price": 3.77,
"price_incl_tax": 3.77,
"price_excl_tax": 3.77
}, {
"price_id": "157895",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "29",
"website_price": 3.69,
"price_incl_tax": 3.69,
"price_excl_tax": 3.69
}, {
"price_id": "158511",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "29",
"website_price": 3.6,
"price_incl_tax": 3.6,
"price_excl_tax": 3.6
}, {
"price_id": "159127",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "29",
"website_price": 3.52,
"price_incl_tax": 3.52,
"price_excl_tax": 3.52
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-29.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-29.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice29()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-29" id="product-save-price-29">
</span>
<span class="sd-price-without-discount-amount product-wod-price-29" id="product-wod-price-29">
</span>
<span class="price-label block"> </span>
<span id="product-price-29" class="sd-unit-price product-price-29">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.19</span> </span> / can </span>
<meta itemprop="price" content="4.19">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-29" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-29" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.19</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-29" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-29" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField29 !== 'function') {
function initQtyField29() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '29',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField29()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[29]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[29]" form="product_addtocart_form29" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[29] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-29', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form29" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/9/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/9/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form9">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="9">
<a href="https://snusdaddy.com/general-white-portion" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-9.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/w/h/white_portion_460x460.png" loading="lazy" width="240" height="300" alt="General White Portion snus can at Snusdaddy.com" title="General White Portion snus can at Snusdaddy.com">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> General <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 5 </div>
<div class="sd-star-green"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/general-white-portion" :id="`slide-desc-9-${$id('slider-id')}`" id="slide-desc-9-slider-id-36">
White Portion </a>
</div>
<div class="mg-per-pouch"> 7 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty9 !== 'function') {
function updateQtyBasedOnTierPriceQty9(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-9');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[9]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-9');
const priceWods = document.getElementsByClassName('product-wod-price-9');
const priceTotals = document.getElementsByClassName('sd-total-price-9');
const pricePerCans = document.getElementsByClassName('product-price-9');
let savePrice = 0;
let customTotalsPrice = 4.19;
var customPerItemPrice = 4.19;
if (qty >= 10) {
savePrice = qty * 0.42;
customTotalsPrice = parseFloat("3.77") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.77;
}
if (qty >= 30) {
savePrice = qty * 0.5;
customTotalsPrice = parseFloat("3.69") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.69;
}
if (qty >= 60) {
savePrice = qty * 0.59;
customTotalsPrice = parseFloat("3.6") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.6;
}
if (qty >= 100) {
savePrice = qty * 0.67;
customTotalsPrice = parseFloat("3.52") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.52;
}
// Calculate the price
const wodPrice = qty * 4.19;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.19);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.19)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-9 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-9" onclick="updateQtyBasedOnTierPriceQty9(this, 1)">
<span>1 can</span>
<span><span class="price">$4.19</span></span>
<span>(<span class="price">$4.19</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-9" onclick="updateQtyBasedOnTierPriceQty9(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="37.7" data-price-type="" class="price-wrapper "><span class="price">$37.70</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="3.77" data-price-type="" class="price-wrapper "><span class="price">$3.77</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-9" onclick="updateQtyBasedOnTierPriceQty9(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="110.7" data-price-type="" class="price-wrapper "><span class="price">$110.70</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="3.69" data-price-type="" class="price-wrapper "><span class="price">$3.69</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-9" onclick="updateQtyBasedOnTierPriceQty9(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="216" data-price-type="" class="price-wrapper "><span class="price">$216.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="3.6" data-price-type="" class="price-wrapper "><span class="price">$3.60</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-9" onclick="updateQtyBasedOnTierPriceQty9(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="352" data-price-type="" class="price-wrapper "><span class="price">$352.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="3.52" data-price-type="" class="price-wrapper "><span class="price">$3.52</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-9" onchange="updateQtyBasedOnTierPriceQty9(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice9() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.19,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "157259",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "9",
"website_price": 3.77,
"price_incl_tax": 3.77,
"price_excl_tax": 3.77
}, {
"price_id": "157875",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "9",
"website_price": 3.69,
"price_incl_tax": 3.69,
"price_excl_tax": 3.69
}, {
"price_id": "158491",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "9",
"website_price": 3.6,
"price_incl_tax": 3.6,
"price_excl_tax": 3.6
}, {
"price_id": "159107",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "9",
"website_price": 3.52,
"price_incl_tax": 3.52,
"price_excl_tax": 3.52
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-9.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-9.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice9()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-9" id="product-save-price-9">
</span>
<span class="sd-price-without-discount-amount product-wod-price-9" id="product-wod-price-9">
</span>
<span class="price-label block"> </span>
<span id="product-price-9" class="sd-unit-price product-price-9">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.19</span> </span> / can </span>
<meta itemprop="price" content="4.19">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-9" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-9" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.19</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-9" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-9" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField9 !== 'function') {
function initQtyField9() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '9',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField9()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[9]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[9]" form="product_addtocart_form9" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[9] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-9', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form9" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/1034/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/1034/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form1034">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="1034">
<a href="https://snusdaddy.com/zyn-mini-dry-black-licorice-3-mg" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-1034.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/b/l/black_licorice_mini_3_mg_460x460.png" loading="lazy" width="240" height="300" alt="ZYN Mini Dry Black Licorice 3 mg" title="ZYN Mini Dry Black Licorice 3 mg">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> ZYN <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/zyn-mini-dry-black-licorice-3-mg" :id="`slide-desc-1034-${$id('slider-id')}`" id="slide-desc-1034-slider-id-37">
Mini Dry Black Licorice 3 mg </a>
</div>
<div class="mg-per-pouch"> 3 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty1034 !== 'function') {
function updateQtyBasedOnTierPriceQty1034(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-1034');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[1034]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-1034');
const priceWods = document.getElementsByClassName('product-wod-price-1034');
const priceTotals = document.getElementsByClassName('sd-total-price-1034');
const pricePerCans = document.getElementsByClassName('product-price-1034');
let savePrice = 0;
let customTotalsPrice = 4.99;
var customPerItemPrice = 4.99;
if (qty >= 10) {
savePrice = qty * 0.5;
customTotalsPrice = parseFloat("4.49") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.49;
}
if (qty >= 30) {
savePrice = qty * 0.6;
customTotalsPrice = parseFloat("4.39") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.39;
}
if (qty >= 60) {
savePrice = qty * 0.7;
customTotalsPrice = parseFloat("4.29") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.29;
}
if (qty >= 100) {
savePrice = qty * 0.8;
customTotalsPrice = parseFloat("4.19") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.19;
}
// Calculate the price
const wodPrice = qty * 4.99;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.99);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.99)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-1034 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-1034" onclick="updateQtyBasedOnTierPriceQty1034(this, 1)">
<span>1 can</span>
<span><span class="price">$4.99</span></span>
<span>(<span class="price">$4.99</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-1034" onclick="updateQtyBasedOnTierPriceQty1034(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="44.9" data-price-type="" class="price-wrapper "><span class="price">$44.90</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="4.49" data-price-type="" class="price-wrapper "><span class="price">$4.49</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-1034" onclick="updateQtyBasedOnTierPriceQty1034(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="131.7" data-price-type="" class="price-wrapper "><span class="price">$131.70</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="4.39" data-price-type="" class="price-wrapper "><span class="price">$4.39</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-1034" onclick="updateQtyBasedOnTierPriceQty1034(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="257.4" data-price-type="" class="price-wrapper "><span class="price">$257.40</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="4.29" data-price-type="" class="price-wrapper "><span class="price">$4.29</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-1034" onclick="updateQtyBasedOnTierPriceQty1034(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="419" data-price-type="" class="price-wrapper "><span class="price">$419.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="4.19" data-price-type="" class="price-wrapper "><span class="price">$4.19</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-1034" onchange="updateQtyBasedOnTierPriceQty1034(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice1034() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.99,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "164226",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "1034",
"website_price": 4.49,
"price_incl_tax": 4.49,
"price_excl_tax": 4.49
}, {
"price_id": "164790",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "1034",
"website_price": 4.39,
"price_incl_tax": 4.39,
"price_excl_tax": 4.39
}, {
"price_id": "165354",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "1034",
"website_price": 4.29,
"price_incl_tax": 4.29,
"price_excl_tax": 4.29
}, {
"price_id": "165918",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "1034",
"website_price": 4.19,
"price_incl_tax": 4.19,
"price_excl_tax": 4.19
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-1034.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-1034.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice1034()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-1034" id="product-save-price-1034">
</span>
<span class="sd-price-without-discount-amount product-wod-price-1034" id="product-wod-price-1034">
</span>
<span class="price-label block"> </span>
<span id="product-price-1034" class="sd-unit-price product-price-1034">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.99</span> </span> / can </span>
<meta itemprop="price" content="4.99">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-1034" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-1034" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.99</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-1034" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-1034" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField1034 !== 'function') {
function initQtyField1034() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '1034',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField1034()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[1034]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[1034]" form="product_addtocart_form1034" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[1034] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-1034', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form1034" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/957/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/957/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form957">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="957">
<a href="https://snusdaddy.com/kelly-white-raspberry-lemon-mini" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-957.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/r/a/raspberry_lemon_460x460.png" loading="lazy" width="240" height="300" alt="Kelly White Raspberry Lemon Mini Product Label" title="Kelly White Raspberry Lemon Mini Product Label">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> Kelly White <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/kelly-white-raspberry-lemon-mini" :id="`slide-desc-957-${$id('slider-id')}`" id="slide-desc-957-slider-id-38">
Raspberry Lemon Mini </a>
</div>
<div class="mg-per-pouch"> 3.2 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty957 !== 'function') {
function updateQtyBasedOnTierPriceQty957(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-957');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[957]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-957');
const priceWods = document.getElementsByClassName('product-wod-price-957');
const priceTotals = document.getElementsByClassName('sd-total-price-957');
const pricePerCans = document.getElementsByClassName('product-price-957');
let savePrice = 0;
let customTotalsPrice = 4.29;
var customPerItemPrice = 4.29;
if (qty >= 10) {
savePrice = qty * 0.43;
customTotalsPrice = parseFloat("3.86") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.86;
}
if (qty >= 30) {
savePrice = qty * 0.51;
customTotalsPrice = parseFloat("3.78") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.78;
}
if (qty >= 60) {
savePrice = qty * 0.6;
customTotalsPrice = parseFloat("3.69") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.69;
}
if (qty >= 100) {
savePrice = qty * 0.69;
customTotalsPrice = parseFloat("3.6") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.6;
}
// Calculate the price
const wodPrice = qty * 4.29;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.29);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.29)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-957 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-957" onclick="updateQtyBasedOnTierPriceQty957(this, 1)">
<span>1 can</span>
<span><span class="price">$4.29</span></span>
<span>(<span class="price">$4.29</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-957" onclick="updateQtyBasedOnTierPriceQty957(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="38.6" data-price-type="" class="price-wrapper "><span class="price">$38.60</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="3.86" data-price-type="" class="price-wrapper "><span class="price">$3.86</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-957" onclick="updateQtyBasedOnTierPriceQty957(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="113.4" data-price-type="" class="price-wrapper "><span class="price">$113.40</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="3.78" data-price-type="" class="price-wrapper "><span class="price">$3.78</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-957" onclick="updateQtyBasedOnTierPriceQty957(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="221.4" data-price-type="" class="price-wrapper "><span class="price">$221.40</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="3.69" data-price-type="" class="price-wrapper "><span class="price">$3.69</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-957" onclick="updateQtyBasedOnTierPriceQty957(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="360" data-price-type="" class="price-wrapper "><span class="price">$360.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="3.6" data-price-type="" class="price-wrapper "><span class="price">$3.60</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-957" onchange="updateQtyBasedOnTierPriceQty957(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice957() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.29,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "163818",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "957",
"website_price": 3.86,
"price_incl_tax": 3.86,
"price_excl_tax": 3.86
}, {
"price_id": "164382",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "957",
"website_price": 3.78,
"price_incl_tax": 3.78,
"price_excl_tax": 3.78
}, {
"price_id": "164946",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "957",
"website_price": 3.69,
"price_incl_tax": 3.69,
"price_excl_tax": 3.69
}, {
"price_id": "165510",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "957",
"website_price": 3.6,
"price_incl_tax": 3.6,
"price_excl_tax": 3.6
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-957.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-957.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice957()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-957" id="product-save-price-957">
</span>
<span class="sd-price-without-discount-amount product-wod-price-957" id="product-wod-price-957">
</span>
<span class="price-label block"> </span>
<span id="product-price-957" class="sd-unit-price product-price-957">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.29</span> </span> / can </span>
<meta itemprop="price" content="4.29">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-957" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-957" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.29</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-957" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-957" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField957 !== 'function') {
function initQtyField957() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '957',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField957()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[957]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[957]" form="product_addtocart_form957" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[957] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-957', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form957" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/955/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/955/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form955">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="955">
<a href="https://snusdaddy.com/kelly-white-hot-cherry-mini" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-955.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/h/o/hot_cherry_460x460.png" loading="lazy" width="240" height="300" alt="Kelly White Hot Cherry Mini Product Label" title="Kelly White Hot Cherry Mini Product Label">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> Kelly White <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/kelly-white-hot-cherry-mini" :id="`slide-desc-955-${$id('slider-id')}`" id="slide-desc-955-slider-id-39">
Hot Cherry Mini </a>
</div>
<div class="mg-per-pouch"> 6.5 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty955 !== 'function') {
function updateQtyBasedOnTierPriceQty955(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-955');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[955]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-955');
const priceWods = document.getElementsByClassName('product-wod-price-955');
const priceTotals = document.getElementsByClassName('sd-total-price-955');
const pricePerCans = document.getElementsByClassName('product-price-955');
let savePrice = 0;
let customTotalsPrice = 4.29;
var customPerItemPrice = 4.29;
if (qty >= 10) {
savePrice = qty * 0.43;
customTotalsPrice = parseFloat("3.86") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.86;
}
if (qty >= 30) {
savePrice = qty * 0.51;
customTotalsPrice = parseFloat("3.78") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.78;
}
if (qty >= 60) {
savePrice = qty * 0.6;
customTotalsPrice = parseFloat("3.69") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.69;
}
if (qty >= 100) {
savePrice = qty * 0.69;
customTotalsPrice = parseFloat("3.6") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.6;
}
// Calculate the price
const wodPrice = qty * 4.29;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.29);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.29)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-955 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-955" onclick="updateQtyBasedOnTierPriceQty955(this, 1)">
<span>1 can</span>
<span><span class="price">$4.29</span></span>
<span>(<span class="price">$4.29</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-955" onclick="updateQtyBasedOnTierPriceQty955(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="38.6" data-price-type="" class="price-wrapper "><span class="price">$38.60</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="3.86" data-price-type="" class="price-wrapper "><span class="price">$3.86</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-955" onclick="updateQtyBasedOnTierPriceQty955(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="113.4" data-price-type="" class="price-wrapper "><span class="price">$113.40</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="3.78" data-price-type="" class="price-wrapper "><span class="price">$3.78</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-955" onclick="updateQtyBasedOnTierPriceQty955(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="221.4" data-price-type="" class="price-wrapper "><span class="price">$221.40</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="3.69" data-price-type="" class="price-wrapper "><span class="price">$3.69</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-955" onclick="updateQtyBasedOnTierPriceQty955(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="360" data-price-type="" class="price-wrapper "><span class="price">$360.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="3.6" data-price-type="" class="price-wrapper "><span class="price">$3.60</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-955" onchange="updateQtyBasedOnTierPriceQty955(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice955() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.29,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "163817",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "955",
"website_price": 3.86,
"price_incl_tax": 3.86,
"price_excl_tax": 3.86
}, {
"price_id": "164381",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "955",
"website_price": 3.78,
"price_incl_tax": 3.78,
"price_excl_tax": 3.78
}, {
"price_id": "164945",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "955",
"website_price": 3.69,
"price_incl_tax": 3.69,
"price_excl_tax": 3.69
}, {
"price_id": "165509",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "955",
"website_price": 3.6,
"price_incl_tax": 3.6,
"price_excl_tax": 3.6
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-955.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-955.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice955()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-955" id="product-save-price-955">
</span>
<span class="sd-price-without-discount-amount product-wod-price-955" id="product-wod-price-955">
</span>
<span class="price-label block"> </span>
<span id="product-price-955" class="sd-unit-price product-price-955">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.29</span> </span> / can </span>
<meta itemprop="price" content="4.29">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-955" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-955" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.29</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-955" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-955" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField955 !== 'function') {
function initQtyField955() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '955',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField955()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[955]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[955]" form="product_addtocart_form955" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[955] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-955', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form955" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/899/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/899/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form899">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="899">
<a href="https://snusdaddy.com/velo-wintery-watermelon-mini" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-899.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/v/e/velo_wintery_watermelon_460x460.png" loading="lazy" width="240" height="300" alt="VELO Wintery Watermelon Mini Product Label" title="VELO Wintery Watermelon Mini Product Label">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> VELO <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/velo-wintery-watermelon-mini" :id="`slide-desc-899-${$id('slider-id')}`" id="slide-desc-899-slider-id-40">
Wintery Watermelon Mini </a>
</div>
<div class="mg-per-pouch"> 6 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty899 !== 'function') {
function updateQtyBasedOnTierPriceQty899(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-899');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[899]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-899');
const priceWods = document.getElementsByClassName('product-wod-price-899');
const priceTotals = document.getElementsByClassName('sd-total-price-899');
const pricePerCans = document.getElementsByClassName('product-price-899');
let savePrice = 0;
let customTotalsPrice = 5.19;
var customPerItemPrice = 5.19;
if (qty >= 10) {
savePrice = qty * 0.52;
customTotalsPrice = parseFloat("4.67") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.67;
}
if (qty >= 30) {
savePrice = qty * 0.62;
customTotalsPrice = parseFloat("4.57") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.57;
}
if (qty >= 60) {
savePrice = qty * 0.73;
customTotalsPrice = parseFloat("4.46") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.46;
}
if (qty >= 100) {
savePrice = qty * 0.83;
customTotalsPrice = parseFloat("4.36") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.36;
}
// Calculate the price
const wodPrice = qty * 5.19;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 5.19);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 5.19)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-899 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-899" onclick="updateQtyBasedOnTierPriceQty899(this, 1)">
<span>1 can</span>
<span><span class="price">$5.19</span></span>
<span>(<span class="price">$5.19</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-899" onclick="updateQtyBasedOnTierPriceQty899(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="46.7" data-price-type="" class="price-wrapper "><span class="price">$46.70</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="4.67" data-price-type="" class="price-wrapper "><span class="price">$4.67</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-899" onclick="updateQtyBasedOnTierPriceQty899(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="137.1" data-price-type="" class="price-wrapper "><span class="price">$137.10</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="4.57" data-price-type="" class="price-wrapper "><span class="price">$4.57</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-899" onclick="updateQtyBasedOnTierPriceQty899(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="267.6" data-price-type="" class="price-wrapper "><span class="price">$267.60</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="4.46" data-price-type="" class="price-wrapper "><span class="price">$4.46</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-899" onclick="updateQtyBasedOnTierPriceQty899(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="436" data-price-type="" class="price-wrapper "><span class="price">$436.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="4.36" data-price-type="" class="price-wrapper "><span class="price">$4.36</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-899" onchange="updateQtyBasedOnTierPriceQty899(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice899() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 5.19,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "164147",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "899",
"website_price": 4.67,
"price_incl_tax": 4.67,
"price_excl_tax": 4.67
}, {
"price_id": "164711",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "899",
"website_price": 4.57,
"price_incl_tax": 4.57,
"price_excl_tax": 4.57
}, {
"price_id": "165275",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "899",
"website_price": 4.46,
"price_incl_tax": 4.46,
"price_excl_tax": 4.46
}, {
"price_id": "165839",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "899",
"website_price": 4.36,
"price_incl_tax": 4.36,
"price_excl_tax": 4.36
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-899.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-899.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice899()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-899" id="product-save-price-899">
</span>
<span class="sd-price-without-discount-amount product-wod-price-899" id="product-wod-price-899">
</span>
<span class="price-label block"> </span>
<span id="product-price-899" class="sd-unit-price product-price-899">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$5.19</span> </span> / can </span>
<meta itemprop="price" content="5.19">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-899" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-899" x-html="getFormattedFinalTotalPrice()">
<span class="price">$5.19</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-899" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-899" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField899 !== 'function') {
function initQtyField899() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '899',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField899()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[899]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[899]" form="product_addtocart_form899" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[899] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-899', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form899" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/897/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/897/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form897">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="897">
<a href="https://snusdaddy.com/velo-crispy-peppermint-mini" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-897.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/v/e/velo_crispy_peppermint_mini_460x460.png" loading="lazy" width="240" height="300" alt="VELO Crispy Peppermint Mini Product Label" title="VELO Crispy Peppermint Mini Product Label">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> VELO <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/velo-crispy-peppermint-mini" :id="`slide-desc-897-${$id('slider-id')}`" id="slide-desc-897-slider-id-41">
Crispy Peppermint Mini </a>
</div>
<div class="mg-per-pouch"> 8 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty897 !== 'function') {
function updateQtyBasedOnTierPriceQty897(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-897');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[897]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-897');
const priceWods = document.getElementsByClassName('product-wod-price-897');
const priceTotals = document.getElementsByClassName('sd-total-price-897');
const pricePerCans = document.getElementsByClassName('product-price-897');
let savePrice = 0;
let customTotalsPrice = 5.19;
var customPerItemPrice = 5.19;
if (qty >= 10) {
savePrice = qty * 0.52;
customTotalsPrice = parseFloat("4.67") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.67;
}
if (qty >= 30) {
savePrice = qty * 0.62;
customTotalsPrice = parseFloat("4.57") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.57;
}
if (qty >= 60) {
savePrice = qty * 0.73;
customTotalsPrice = parseFloat("4.46") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.46;
}
if (qty >= 100) {
savePrice = qty * 0.83;
customTotalsPrice = parseFloat("4.36") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.36;
}
// Calculate the price
const wodPrice = qty * 5.19;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 5.19);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 5.19)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-897 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-897" onclick="updateQtyBasedOnTierPriceQty897(this, 1)">
<span>1 can</span>
<span><span class="price">$5.19</span></span>
<span>(<span class="price">$5.19</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-897" onclick="updateQtyBasedOnTierPriceQty897(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="46.7" data-price-type="" class="price-wrapper "><span class="price">$46.70</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="4.67" data-price-type="" class="price-wrapper "><span class="price">$4.67</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-897" onclick="updateQtyBasedOnTierPriceQty897(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="137.1" data-price-type="" class="price-wrapper "><span class="price">$137.10</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="4.57" data-price-type="" class="price-wrapper "><span class="price">$4.57</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-897" onclick="updateQtyBasedOnTierPriceQty897(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="267.6" data-price-type="" class="price-wrapper "><span class="price">$267.60</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="4.46" data-price-type="" class="price-wrapper "><span class="price">$4.46</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-897" onclick="updateQtyBasedOnTierPriceQty897(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="436" data-price-type="" class="price-wrapper "><span class="price">$436.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="4.36" data-price-type="" class="price-wrapper "><span class="price">$4.36</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-897" onchange="updateQtyBasedOnTierPriceQty897(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice897() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 5.19,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "164041",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "897",
"website_price": 4.67,
"price_incl_tax": 4.67,
"price_excl_tax": 4.67
}, {
"price_id": "164640",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "897",
"website_price": 4.57,
"price_incl_tax": 4.57,
"price_excl_tax": 4.57
}, {
"price_id": "165219",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "897",
"website_price": 4.46,
"price_incl_tax": 4.46,
"price_excl_tax": 4.46
}, {
"price_id": "165738",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "897",
"website_price": 4.36,
"price_incl_tax": 4.36,
"price_excl_tax": 4.36
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-897.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-897.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice897()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-897" id="product-save-price-897">
</span>
<span class="sd-price-without-discount-amount product-wod-price-897" id="product-wod-price-897">
</span>
<span class="price-label block"> </span>
<span id="product-price-897" class="sd-unit-price product-price-897">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$5.19</span> </span> / can </span>
<meta itemprop="price" content="5.19">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-897" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-897" x-html="getFormattedFinalTotalPrice()">
<span class="price">$5.19</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-897" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-897" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField897 !== 'function') {
function initQtyField897() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '897',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField897()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[897]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[897]" form="product_addtocart_form897" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[897] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-897', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form897" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/788/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/788/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form788">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="788">
<a href="https://snusdaddy.com/loop-red-chili-melon-mini" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-788.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/r/e/red_chili_melon_mini_460x460.png" loading="lazy" width="240" height="300" alt="LOOP Red Chili Melon Mini Product Label" title="LOOP Red Chili Melon Mini Product Label">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> LOOP <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/loop-red-chili-melon-mini" :id="`slide-desc-788-${$id('slider-id')}`" id="slide-desc-788-slider-id-42">
Red Chili Melon Mini </a>
</div>
<div class="mg-per-pouch"> 6.8 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty788 !== 'function') {
function updateQtyBasedOnTierPriceQty788(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-788');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[788]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-788');
const priceWods = document.getElementsByClassName('product-wod-price-788');
const priceTotals = document.getElementsByClassName('sd-total-price-788');
const pricePerCans = document.getElementsByClassName('product-price-788');
let savePrice = 0;
let customTotalsPrice = 4.49;
var customPerItemPrice = 4.49;
if (qty >= 10) {
savePrice = qty * 0.45;
customTotalsPrice = parseFloat("4.04") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.04;
}
if (qty >= 30) {
savePrice = qty * 0.54;
customTotalsPrice = parseFloat("3.95") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.95;
}
if (qty >= 60) {
savePrice = qty * 0.63;
customTotalsPrice = parseFloat("3.86") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.86;
}
if (qty >= 100) {
savePrice = qty * 0.72;
customTotalsPrice = parseFloat("3.77") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.77;
}
// Calculate the price
const wodPrice = qty * 4.49;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.49);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.49)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-788 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-788" onclick="updateQtyBasedOnTierPriceQty788(this, 1)">
<span>1 can</span>
<span><span class="price">$4.49</span></span>
<span>(<span class="price">$4.49</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-788" onclick="updateQtyBasedOnTierPriceQty788(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="40.4" data-price-type="" class="price-wrapper "><span class="price">$40.40</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="4.04" data-price-type="" class="price-wrapper "><span class="price">$4.04</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-788" onclick="updateQtyBasedOnTierPriceQty788(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="118.5" data-price-type="" class="price-wrapper "><span class="price">$118.50</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="3.95" data-price-type="" class="price-wrapper "><span class="price">$3.95</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-788" onclick="updateQtyBasedOnTierPriceQty788(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="231.6" data-price-type="" class="price-wrapper "><span class="price">$231.60</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="3.86" data-price-type="" class="price-wrapper "><span class="price">$3.86</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-788" onclick="updateQtyBasedOnTierPriceQty788(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="377" data-price-type="" class="price-wrapper "><span class="price">$377.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="3.77" data-price-type="" class="price-wrapper "><span class="price">$3.77</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-788" onchange="updateQtyBasedOnTierPriceQty788(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice788() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.49,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "163917",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "788",
"website_price": 4.04,
"price_incl_tax": 4.04,
"price_excl_tax": 4.04
}, {
"price_id": "164481",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "788",
"website_price": 3.95,
"price_incl_tax": 3.95,
"price_excl_tax": 3.95
}, {
"price_id": "165045",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "788",
"website_price": 3.86,
"price_incl_tax": 3.86,
"price_excl_tax": 3.86
}, {
"price_id": "165609",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "788",
"website_price": 3.77,
"price_incl_tax": 3.77,
"price_excl_tax": 3.77
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-788.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-788.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice788()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-788" id="product-save-price-788">
</span>
<span class="sd-price-without-discount-amount product-wod-price-788" id="product-wod-price-788">
</span>
<span class="price-label block"> </span>
<span id="product-price-788" class="sd-unit-price product-price-788">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.49</span> </span> / can </span>
<meta itemprop="price" content="4.49">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-788" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-788" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.49</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-788" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-788" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField788 !== 'function') {
function initQtyField788() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '788',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField788()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[788]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[788]" form="product_addtocart_form788" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[788] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-788', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form788" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/651/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/651/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form651">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="651">
<a href="https://snusdaddy.com/zyn-mini-black-cherry-6-mg" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-651.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/b/l/black_cherry_strong_460x460.png" loading="lazy" width="240" height="300" alt="ZYN Mini Black Cherry 6 mg Product Label" title="ZYN Mini Black Cherry 6 mg Product Label">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> ZYN <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 4.7 </div>
<div class="sd-star-green"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/zyn-mini-black-cherry-6-mg" :id="`slide-desc-651-${$id('slider-id')}`" id="slide-desc-651-slider-id-43">
Mini Dry Black Cherry 6 mg </a>
</div>
<div class="mg-per-pouch"> 6 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty651 !== 'function') {
function updateQtyBasedOnTierPriceQty651(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-651');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[651]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-651');
const priceWods = document.getElementsByClassName('product-wod-price-651');
const priceTotals = document.getElementsByClassName('sd-total-price-651');
const pricePerCans = document.getElementsByClassName('product-price-651');
let savePrice = 0;
let customTotalsPrice = 4.99;
var customPerItemPrice = 4.99;
if (qty >= 10) {
savePrice = qty * 0.5;
customTotalsPrice = parseFloat("4.49") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.49;
}
if (qty >= 30) {
savePrice = qty * 0.6;
customTotalsPrice = parseFloat("4.39") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.39;
}
if (qty >= 60) {
savePrice = qty * 0.7;
customTotalsPrice = parseFloat("4.29") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.29;
}
if (qty >= 100) {
savePrice = qty * 0.8;
customTotalsPrice = parseFloat("4.19") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.19;
}
// Calculate the price
const wodPrice = qty * 4.99;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.99);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.99)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-651 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-651" onclick="updateQtyBasedOnTierPriceQty651(this, 1)">
<span>1 can</span>
<span><span class="price">$4.99</span></span>
<span>(<span class="price">$4.99</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-651" onclick="updateQtyBasedOnTierPriceQty651(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="44.9" data-price-type="" class="price-wrapper "><span class="price">$44.90</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="4.49" data-price-type="" class="price-wrapper "><span class="price">$4.49</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-651" onclick="updateQtyBasedOnTierPriceQty651(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="131.7" data-price-type="" class="price-wrapper "><span class="price">$131.70</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="4.39" data-price-type="" class="price-wrapper "><span class="price">$4.39</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-651" onclick="updateQtyBasedOnTierPriceQty651(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="257.4" data-price-type="" class="price-wrapper "><span class="price">$257.40</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="4.29" data-price-type="" class="price-wrapper "><span class="price">$4.29</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-651" onclick="updateQtyBasedOnTierPriceQty651(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="419" data-price-type="" class="price-wrapper "><span class="price">$419.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="4.19" data-price-type="" class="price-wrapper "><span class="price">$4.19</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-651" onchange="updateQtyBasedOnTierPriceQty651(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice651() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.99,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "164225",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "651",
"website_price": 4.49,
"price_incl_tax": 4.49,
"price_excl_tax": 4.49
}, {
"price_id": "164789",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "651",
"website_price": 4.39,
"price_incl_tax": 4.39,
"price_excl_tax": 4.39
}, {
"price_id": "165353",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "651",
"website_price": 4.29,
"price_incl_tax": 4.29,
"price_excl_tax": 4.29
}, {
"price_id": "165917",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "651",
"website_price": 4.19,
"price_incl_tax": 4.19,
"price_excl_tax": 4.19
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-651.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-651.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice651()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-651" id="product-save-price-651">
</span>
<span class="sd-price-without-discount-amount product-wod-price-651" id="product-wod-price-651">
</span>
<span class="price-label block"> </span>
<span id="product-price-651" class="sd-unit-price product-price-651">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.99</span> </span> / can </span>
<meta itemprop="price" content="4.99">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-651" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-651" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.99</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-651" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-651" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField651 !== 'function') {
function initQtyField651() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '651',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField651()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[651]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[651]" form="product_addtocart_form651" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[651] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-651', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form651" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/625/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/625/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form625">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="625">
<a href="https://snusdaddy.com/pablo-mini-ice-cold" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-625.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/m/i/mini_460x460_ice_cold.png" loading="lazy" width="240" height="300" alt="Pablo Mini Ice Cold Product Label" title="Pablo Mini Ice Cold Product Label">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> Pablo <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 5 </div>
<div class="sd-star-green"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/pablo-mini-ice-cold" :id="`slide-desc-625-${$id('slider-id')}`" id="slide-desc-625-slider-id-44">
Mini Ice Cold </a>
</div>
<div class="mg-per-pouch"> 15 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty625 !== 'function') {
function updateQtyBasedOnTierPriceQty625(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-625');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[625]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-625');
const priceWods = document.getElementsByClassName('product-wod-price-625');
const priceTotals = document.getElementsByClassName('sd-total-price-625');
const pricePerCans = document.getElementsByClassName('product-price-625');
let savePrice = 0;
let customTotalsPrice = 4.39;
var customPerItemPrice = 4.39;
if (qty >= 10) {
savePrice = qty * 0.44;
customTotalsPrice = parseFloat("3.95") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.95;
}
if (qty >= 30) {
savePrice = qty * 0.53;
customTotalsPrice = parseFloat("3.86") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.86;
}
if (qty >= 60) {
savePrice = qty * 0.61;
customTotalsPrice = parseFloat("3.78") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.78;
}
if (qty >= 100) {
savePrice = qty * 0.7;
customTotalsPrice = parseFloat("3.69") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.69;
}
// Calculate the price
const wodPrice = qty * 4.39;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.39);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.39)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-625 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-625" onclick="updateQtyBasedOnTierPriceQty625(this, 1)">
<span>1 can</span>
<span><span class="price">$4.39</span></span>
<span>(<span class="price">$4.39</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-625" onclick="updateQtyBasedOnTierPriceQty625(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="39.5" data-price-type="" class="price-wrapper "><span class="price">$39.50</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="3.95" data-price-type="" class="price-wrapper "><span class="price">$3.95</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-625" onclick="updateQtyBasedOnTierPriceQty625(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="115.8" data-price-type="" class="price-wrapper "><span class="price">$115.80</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="3.86" data-price-type="" class="price-wrapper "><span class="price">$3.86</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-625" onclick="updateQtyBasedOnTierPriceQty625(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="226.8" data-price-type="" class="price-wrapper "><span class="price">$226.80</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="3.78" data-price-type="" class="price-wrapper "><span class="price">$3.78</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-625" onclick="updateQtyBasedOnTierPriceQty625(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="369" data-price-type="" class="price-wrapper "><span class="price">$369.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="3.69" data-price-type="" class="price-wrapper "><span class="price">$3.69</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-625" onchange="updateQtyBasedOnTierPriceQty625(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice625() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.39,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "173186",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "625",
"website_price": 3.95,
"price_incl_tax": 3.95,
"price_excl_tax": 3.95
}, {
"price_id": "173187",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "625",
"website_price": 3.86,
"price_incl_tax": 3.86,
"price_excl_tax": 3.86
}, {
"price_id": "173188",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "625",
"website_price": 3.78,
"price_incl_tax": 3.78,
"price_excl_tax": 3.78
}, {
"price_id": "173256",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "625",
"website_price": 3.69,
"price_incl_tax": 3.69,
"price_excl_tax": 3.69
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-625.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-625.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice625()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-625" id="product-save-price-625">
</span>
<span class="sd-price-without-discount-amount product-wod-price-625" id="product-wod-price-625">
</span>
<span class="price-label block"> </span>
<span id="product-price-625" class="sd-unit-price product-price-625">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.39</span> </span> / can </span>
<meta itemprop="price" content="4.39">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-625" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-625" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.39</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-625" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-625" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField625 !== 'function') {
function initQtyField625() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '625',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField625()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[625]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[625]" form="product_addtocart_form625" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[625] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-625', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form625" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/257/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/257/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form257">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="257">
<a href="https://snusdaddy.com/loop-mint-mania-mini" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-257.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/m/i/mint_mania_mini_460x460.png" loading="lazy" width="240" height="300" alt="LOOP Mint Mania Mini Product Label" title="LOOP Mint Mania Mini Product Label">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> LOOP <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 5 </div>
<div class="sd-star-green"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/loop-mint-mania-mini" :id="`slide-desc-257-${$id('slider-id')}`" id="slide-desc-257-slider-id-45">
Mint Mania Mini </a>
</div>
<div class="mg-per-pouch"> 3 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty257 !== 'function') {
function updateQtyBasedOnTierPriceQty257(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-257');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[257]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-257');
const priceWods = document.getElementsByClassName('product-wod-price-257');
const priceTotals = document.getElementsByClassName('sd-total-price-257');
const pricePerCans = document.getElementsByClassName('product-price-257');
let savePrice = 0;
let customTotalsPrice = 4.49;
var customPerItemPrice = 4.49;
if (qty >= 10) {
savePrice = qty * 0.45;
customTotalsPrice = parseFloat("4.04") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.04;
}
if (qty >= 30) {
savePrice = qty * 0.54;
customTotalsPrice = parseFloat("3.95") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.95;
}
if (qty >= 60) {
savePrice = qty * 0.63;
customTotalsPrice = parseFloat("3.86") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.86;
}
if (qty >= 100) {
savePrice = qty * 0.72;
customTotalsPrice = parseFloat("3.77") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.77;
}
// Calculate the price
const wodPrice = qty * 4.49;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.49);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.49)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-257 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-257" onclick="updateQtyBasedOnTierPriceQty257(this, 1)">
<span>1 can</span>
<span><span class="price">$4.49</span></span>
<span>(<span class="price">$4.49</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-257" onclick="updateQtyBasedOnTierPriceQty257(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="40.4" data-price-type="" class="price-wrapper "><span class="price">$40.40</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="4.04" data-price-type="" class="price-wrapper "><span class="price">$4.04</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-257" onclick="updateQtyBasedOnTierPriceQty257(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="118.5" data-price-type="" class="price-wrapper "><span class="price">$118.50</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="3.95" data-price-type="" class="price-wrapper "><span class="price">$3.95</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-257" onclick="updateQtyBasedOnTierPriceQty257(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="231.6" data-price-type="" class="price-wrapper "><span class="price">$231.60</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="3.86" data-price-type="" class="price-wrapper "><span class="price">$3.86</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-257" onclick="updateQtyBasedOnTierPriceQty257(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="377" data-price-type="" class="price-wrapper "><span class="price">$377.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="3.77" data-price-type="" class="price-wrapper "><span class="price">$3.77</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-257" onchange="updateQtyBasedOnTierPriceQty257(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice257() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.49,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "163913",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "257",
"website_price": 4.04,
"price_incl_tax": 4.04,
"price_excl_tax": 4.04
}, {
"price_id": "164477",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "257",
"website_price": 3.95,
"price_incl_tax": 3.95,
"price_excl_tax": 3.95
}, {
"price_id": "165041",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "257",
"website_price": 3.86,
"price_incl_tax": 3.86,
"price_excl_tax": 3.86
}, {
"price_id": "165605",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "257",
"website_price": 3.77,
"price_incl_tax": 3.77,
"price_excl_tax": 3.77
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-257.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-257.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice257()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-257" id="product-save-price-257">
</span>
<span class="sd-price-without-discount-amount product-wod-price-257" id="product-wod-price-257">
</span>
<span class="price-label block"> </span>
<span id="product-price-257" class="sd-unit-price product-price-257">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.49</span> </span> / can </span>
<meta itemprop="price" content="4.49">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-257" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-257" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.49</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-257" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-257" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField257 !== 'function') {
function initQtyField257() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '257',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField257()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[257]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[257]" form="product_addtocart_form257" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[257] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-257', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form257" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/122/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/122/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form122">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="122">
<a href="https://snusdaddy.com/zyn-bellini-mini-dry-3-mg" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-122.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/b/e/bellini_460x460.png" loading="lazy" width="240" height="300" alt="ZYN Mini Dry Bellini 3 mg Product Label" title="ZYN Mini Dry Bellini 3 mg Product Label">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> ZYN <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 4.6 </div>
<div class="sd-star-green"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/zyn-bellini-mini-dry-3-mg" :id="`slide-desc-122-${$id('slider-id')}`" id="slide-desc-122-slider-id-46">
Mini Bellini 3 mg </a>
</div>
<div class="mg-per-pouch"> 3 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty122 !== 'function') {
function updateQtyBasedOnTierPriceQty122(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-122');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[122]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-122');
const priceWods = document.getElementsByClassName('product-wod-price-122');
const priceTotals = document.getElementsByClassName('sd-total-price-122');
const pricePerCans = document.getElementsByClassName('product-price-122');
let savePrice = 0;
let customTotalsPrice = 4.99;
var customPerItemPrice = 4.99;
if (qty >= 10) {
savePrice = qty * 0.5;
customTotalsPrice = parseFloat("4.49") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.49;
}
if (qty >= 30) {
savePrice = qty * 0.6;
customTotalsPrice = parseFloat("4.39") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.39;
}
if (qty >= 60) {
savePrice = qty * 0.7;
customTotalsPrice = parseFloat("4.29") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.29;
}
if (qty >= 100) {
savePrice = qty * 0.8;
customTotalsPrice = parseFloat("4.19") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.19;
}
// Calculate the price
const wodPrice = qty * 4.99;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.99);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.99)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-122 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-122" onclick="updateQtyBasedOnTierPriceQty122(this, 1)">
<span>1 can</span>
<span><span class="price">$4.99</span></span>
<span>(<span class="price">$4.99</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-122" onclick="updateQtyBasedOnTierPriceQty122(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="44.9" data-price-type="" class="price-wrapper "><span class="price">$44.90</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="4.49" data-price-type="" class="price-wrapper "><span class="price">$4.49</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-122" onclick="updateQtyBasedOnTierPriceQty122(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="131.7" data-price-type="" class="price-wrapper "><span class="price">$131.70</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="4.39" data-price-type="" class="price-wrapper "><span class="price">$4.39</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-122" onclick="updateQtyBasedOnTierPriceQty122(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="257.4" data-price-type="" class="price-wrapper "><span class="price">$257.40</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="4.29" data-price-type="" class="price-wrapper "><span class="price">$4.29</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-122" onclick="updateQtyBasedOnTierPriceQty122(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="419" data-price-type="" class="price-wrapper "><span class="price">$419.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="4.19" data-price-type="" class="price-wrapper "><span class="price">$4.19</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-122" onchange="updateQtyBasedOnTierPriceQty122(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice122() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.99,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "164222",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "122",
"website_price": 4.49,
"price_incl_tax": 4.49,
"price_excl_tax": 4.49
}, {
"price_id": "164786",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "122",
"website_price": 4.39,
"price_incl_tax": 4.39,
"price_excl_tax": 4.39
}, {
"price_id": "165350",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "122",
"website_price": 4.29,
"price_incl_tax": 4.29,
"price_excl_tax": 4.29
}, {
"price_id": "165914",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "122",
"website_price": 4.19,
"price_incl_tax": 4.19,
"price_excl_tax": 4.19
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-122.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-122.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice122()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-122" id="product-save-price-122">
</span>
<span class="sd-price-without-discount-amount product-wod-price-122" id="product-wod-price-122">
</span>
<span class="price-label block"> </span>
<span id="product-price-122" class="sd-unit-price product-price-122">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.99</span> </span> / can </span>
<meta itemprop="price" content="4.99">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-122" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-122" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.99</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-122" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-122" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField122 !== 'function') {
function initQtyField122() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '122',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField122()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[122]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[122]" form="product_addtocart_form122" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[122] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-122', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form122" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/77/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/77/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form77">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="77">
<a href="https://snusdaddy.com/zyn-mini-dry-spearmint-1-5-mg" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-77.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/s/p/spearmint_460x460.png" loading="lazy" width="240" height="300" alt="ZYN Mini Dry Spearmint snus can at Snusdaddy.com" title="ZYN Mini Dry Spearmint snus can at Snusdaddy.com">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> ZYN <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 5 </div>
<div class="sd-star-green"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/zyn-mini-dry-spearmint-1-5-mg" :id="`slide-desc-77-${$id('slider-id')}`" id="slide-desc-77-slider-id-47">
Mini Spearmint 1.5 mg </a>
</div>
<div class="mg-per-pouch"> 1.5 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty77 !== 'function') {
function updateQtyBasedOnTierPriceQty77(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-77');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[77]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-77');
const priceWods = document.getElementsByClassName('product-wod-price-77');
const priceTotals = document.getElementsByClassName('sd-total-price-77');
const pricePerCans = document.getElementsByClassName('product-price-77');
let savePrice = 0;
let customTotalsPrice = 4.99;
var customPerItemPrice = 4.99;
if (qty >= 10) {
savePrice = qty * 0.5;
customTotalsPrice = parseFloat("4.49") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.49;
}
if (qty >= 30) {
savePrice = qty * 0.6;
customTotalsPrice = parseFloat("4.39") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.39;
}
if (qty >= 60) {
savePrice = qty * 0.7;
customTotalsPrice = parseFloat("4.29") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.29;
}
if (qty >= 100) {
savePrice = qty * 0.8;
customTotalsPrice = parseFloat("4.19") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.19;
}
// Calculate the price
const wodPrice = qty * 4.99;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.99);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.99)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-77 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-77" onclick="updateQtyBasedOnTierPriceQty77(this, 1)">
<span>1 can</span>
<span><span class="price">$4.99</span></span>
<span>(<span class="price">$4.99</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-77" onclick="updateQtyBasedOnTierPriceQty77(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="44.9" data-price-type="" class="price-wrapper "><span class="price">$44.90</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="4.49" data-price-type="" class="price-wrapper "><span class="price">$4.49</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-77" onclick="updateQtyBasedOnTierPriceQty77(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="131.7" data-price-type="" class="price-wrapper "><span class="price">$131.70</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="4.39" data-price-type="" class="price-wrapper "><span class="price">$4.39</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-77" onclick="updateQtyBasedOnTierPriceQty77(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="257.4" data-price-type="" class="price-wrapper "><span class="price">$257.40</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="4.29" data-price-type="" class="price-wrapper "><span class="price">$4.29</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-77" onclick="updateQtyBasedOnTierPriceQty77(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="419" data-price-type="" class="price-wrapper "><span class="price">$419.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="4.19" data-price-type="" class="price-wrapper "><span class="price">$4.19</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-77" onchange="updateQtyBasedOnTierPriceQty77(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice77() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.99,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "164238",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "77",
"website_price": 4.49,
"price_incl_tax": 4.49,
"price_excl_tax": 4.49
}, {
"price_id": "164802",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "77",
"website_price": 4.39,
"price_incl_tax": 4.39,
"price_excl_tax": 4.39
}, {
"price_id": "165366",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "77",
"website_price": 4.29,
"price_incl_tax": 4.29,
"price_excl_tax": 4.29
}, {
"price_id": "165930",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "77",
"website_price": 4.19,
"price_incl_tax": 4.19,
"price_excl_tax": 4.19
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-77.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-77.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice77()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-77" id="product-save-price-77">
</span>
<span class="sd-price-without-discount-amount product-wod-price-77" id="product-wod-price-77">
</span>
<span class="price-label block"> </span>
<span id="product-price-77" class="sd-unit-price product-price-77">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.99</span> </span> / can </span>
<meta itemprop="price" content="4.99">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-77" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-77" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.99</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-77" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-77" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField77 !== 'function') {
function initQtyField77() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '77',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField77()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[77]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[77]" form="product_addtocart_form77" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[77] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-77', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form77" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/74/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/74/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form74">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="74">
<a href="https://snusdaddy.com/zyn-mini-dry-cool-mint-3-mg" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-74.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/c/o/cool_mint_460x460_1.png" loading="lazy" width="240" height="300" alt="ZYN Mini Dry Cool Mint snus can at Snusdaddy.com" title="ZYN Mini Dry Cool Mint snus can at Snusdaddy.com">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> ZYN <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/zyn-mini-dry-cool-mint-3-mg" :id="`slide-desc-74-${$id('slider-id')}`" id="slide-desc-74-slider-id-48">
Mini Cool Mint 3 mg </a>
</div>
<div class="mg-per-pouch"> 3 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty74 !== 'function') {
function updateQtyBasedOnTierPriceQty74(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-74');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[74]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-74');
const priceWods = document.getElementsByClassName('product-wod-price-74');
const priceTotals = document.getElementsByClassName('sd-total-price-74');
const pricePerCans = document.getElementsByClassName('product-price-74');
let savePrice = 0;
let customTotalsPrice = 4.99;
var customPerItemPrice = 4.99;
if (qty >= 10) {
savePrice = qty * 0.5;
customTotalsPrice = parseFloat("4.49") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.49;
}
if (qty >= 30) {
savePrice = qty * 0.6;
customTotalsPrice = parseFloat("4.39") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.39;
}
if (qty >= 60) {
savePrice = qty * 0.7;
customTotalsPrice = parseFloat("4.29") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.29;
}
if (qty >= 100) {
savePrice = qty * 0.8;
customTotalsPrice = parseFloat("4.19") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.19;
}
// Calculate the price
const wodPrice = qty * 4.99;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.99);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.99)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-74 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-74" onclick="updateQtyBasedOnTierPriceQty74(this, 1)">
<span>1 can</span>
<span><span class="price">$4.99</span></span>
<span>(<span class="price">$4.99</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-74" onclick="updateQtyBasedOnTierPriceQty74(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="44.9" data-price-type="" class="price-wrapper "><span class="price">$44.90</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="4.49" data-price-type="" class="price-wrapper "><span class="price">$4.49</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-74" onclick="updateQtyBasedOnTierPriceQty74(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="131.7" data-price-type="" class="price-wrapper "><span class="price">$131.70</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="4.39" data-price-type="" class="price-wrapper "><span class="price">$4.39</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-74" onclick="updateQtyBasedOnTierPriceQty74(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="257.4" data-price-type="" class="price-wrapper "><span class="price">$257.40</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="4.29" data-price-type="" class="price-wrapper "><span class="price">$4.29</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-74" onclick="updateQtyBasedOnTierPriceQty74(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="419" data-price-type="" class="price-wrapper "><span class="price">$419.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="4.19" data-price-type="" class="price-wrapper "><span class="price">$4.19</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-74" onchange="updateQtyBasedOnTierPriceQty74(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice74() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.99,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "164229",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "74",
"website_price": 4.49,
"price_incl_tax": 4.49,
"price_excl_tax": 4.49
}, {
"price_id": "164793",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "74",
"website_price": 4.39,
"price_incl_tax": 4.39,
"price_excl_tax": 4.39
}, {
"price_id": "165357",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "74",
"website_price": 4.29,
"price_incl_tax": 4.29,
"price_excl_tax": 4.29
}, {
"price_id": "165921",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "74",
"website_price": 4.19,
"price_incl_tax": 4.19,
"price_excl_tax": 4.19
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-74.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-74.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice74()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-74" id="product-save-price-74">
</span>
<span class="sd-price-without-discount-amount product-wod-price-74" id="product-wod-price-74">
</span>
<span class="price-label block"> </span>
<span id="product-price-74" class="sd-unit-price product-price-74">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.99</span> </span> / can </span>
<meta itemprop="price" content="4.99">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-74" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-74" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.99</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-74" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-74" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField74 !== 'function') {
function initQtyField74() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '74',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField74()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[74]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[74]" form="product_addtocart_form74" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[74] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-74', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form74" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/1057/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/1057/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form1057">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="1057">
<a href="https://snusdaddy.com/tiel-energy-original-mint" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-1057.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/t/i/tiel_original_mint_460x460.png" loading="lazy" width="240" height="300" alt="TIEL Energy Original Mint" title="TIEL Energy Original Mint">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> TIEL <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/tiel-energy-original-mint" :id="`slide-desc-1057-${$id('slider-id')}`" id="slide-desc-1057-slider-id-49">
Original Mint </a>
</div>
<div class="mg-per-pouch"> 0 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty1057 !== 'function') {
function updateQtyBasedOnTierPriceQty1057(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-1057');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[1057]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-1057');
const priceWods = document.getElementsByClassName('product-wod-price-1057');
const priceTotals = document.getElementsByClassName('sd-total-price-1057');
const pricePerCans = document.getElementsByClassName('product-price-1057');
let savePrice = 0;
let customTotalsPrice = 4.29;
var customPerItemPrice = 4.29;
if (qty >= 10) {
savePrice = qty * 0.43;
customTotalsPrice = parseFloat("3.86") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.86;
}
if (qty >= 30) {
savePrice = qty * 0.51;
customTotalsPrice = parseFloat("3.78") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.78;
}
if (qty >= 60) {
savePrice = qty * 0.6;
customTotalsPrice = parseFloat("3.69") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.69;
}
if (qty >= 100) {
savePrice = qty * 0.69;
customTotalsPrice = parseFloat("3.6") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.6;
}
// Calculate the price
const wodPrice = qty * 4.29;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.29);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.29)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-1057 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-1057" onclick="updateQtyBasedOnTierPriceQty1057(this, 1)">
<span>1 can</span>
<span><span class="price">$4.29</span></span>
<span>(<span class="price">$4.29</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-1057" onclick="updateQtyBasedOnTierPriceQty1057(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="38.6" data-price-type="" class="price-wrapper "><span class="price">$38.60</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="3.86" data-price-type="" class="price-wrapper "><span class="price">$3.86</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-1057" onclick="updateQtyBasedOnTierPriceQty1057(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="113.4" data-price-type="" class="price-wrapper "><span class="price">$113.40</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="3.78" data-price-type="" class="price-wrapper "><span class="price">$3.78</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-1057" onclick="updateQtyBasedOnTierPriceQty1057(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="221.4" data-price-type="" class="price-wrapper "><span class="price">$221.40</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="3.69" data-price-type="" class="price-wrapper "><span class="price">$3.69</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-1057" onclick="updateQtyBasedOnTierPriceQty1057(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="360" data-price-type="" class="price-wrapper "><span class="price">$360.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="3.6" data-price-type="" class="price-wrapper "><span class="price">$3.60</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-1057" onchange="updateQtyBasedOnTierPriceQty1057(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice1057() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.29,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "164026",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "1057",
"website_price": 3.86,
"price_incl_tax": 3.86,
"price_excl_tax": 3.86
}, {
"price_id": "164625",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "1057",
"website_price": 3.78,
"price_incl_tax": 3.78,
"price_excl_tax": 3.78
}, {
"price_id": "165128",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "1057",
"website_price": 3.69,
"price_incl_tax": 3.69,
"price_excl_tax": 3.69
}, {
"price_id": "165723",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "1057",
"website_price": 3.6,
"price_incl_tax": 3.6,
"price_excl_tax": 3.6
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-1057.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-1057.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice1057()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-1057" id="product-save-price-1057">
</span>
<span class="sd-price-without-discount-amount product-wod-price-1057" id="product-wod-price-1057">
</span>
<span class="price-label block"> </span>
<span id="product-price-1057" class="sd-unit-price product-price-1057">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.29</span> </span> / can </span>
<meta itemprop="price" content="4.29">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-1057" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-1057" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.29</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-1057" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-1057" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField1057 !== 'function') {
function initQtyField1057() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '1057',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField1057()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[1057]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[1057]" form="product_addtocart_form1057" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[1057] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-1057', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form1057" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/1056/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/1056/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form1056">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="1056">
<a href="https://snusdaddy.com/tiel-energy-violet-licorice" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-1056.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/t/i/tiel_violet_licorice_460x460.png" loading="lazy" width="240" height="300" alt="TIEL Energy Violet Licorice" title="TIEL Energy Violet Licorice">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> TIEL <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/tiel-energy-violet-licorice" :id="`slide-desc-1056-${$id('slider-id')}`" id="slide-desc-1056-slider-id-50">
Violet Licorice </a>
</div>
<div class="mg-per-pouch"> 0 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty1056 !== 'function') {
function updateQtyBasedOnTierPriceQty1056(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-1056');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[1056]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-1056');
const priceWods = document.getElementsByClassName('product-wod-price-1056');
const priceTotals = document.getElementsByClassName('sd-total-price-1056');
const pricePerCans = document.getElementsByClassName('product-price-1056');
let savePrice = 0;
let customTotalsPrice = 4.29;
var customPerItemPrice = 4.29;
if (qty >= 10) {
savePrice = qty * 0.43;
customTotalsPrice = parseFloat("3.86") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.86;
}
if (qty >= 30) {
savePrice = qty * 0.51;
customTotalsPrice = parseFloat("3.78") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.78;
}
if (qty >= 60) {
savePrice = qty * 0.6;
customTotalsPrice = parseFloat("3.69") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.69;
}
if (qty >= 100) {
savePrice = qty * 0.69;
customTotalsPrice = parseFloat("3.6") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.6;
}
// Calculate the price
const wodPrice = qty * 4.29;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.29);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.29)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-1056 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-1056" onclick="updateQtyBasedOnTierPriceQty1056(this, 1)">
<span>1 can</span>
<span><span class="price">$4.29</span></span>
<span>(<span class="price">$4.29</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-1056" onclick="updateQtyBasedOnTierPriceQty1056(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="38.6" data-price-type="" class="price-wrapper "><span class="price">$38.60</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="3.86" data-price-type="" class="price-wrapper "><span class="price">$3.86</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-1056" onclick="updateQtyBasedOnTierPriceQty1056(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="113.4" data-price-type="" class="price-wrapper "><span class="price">$113.40</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="3.78" data-price-type="" class="price-wrapper "><span class="price">$3.78</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-1056" onclick="updateQtyBasedOnTierPriceQty1056(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="221.4" data-price-type="" class="price-wrapper "><span class="price">$221.40</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="3.69" data-price-type="" class="price-wrapper "><span class="price">$3.69</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-1056" onclick="updateQtyBasedOnTierPriceQty1056(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="360" data-price-type="" class="price-wrapper "><span class="price">$360.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="3.6" data-price-type="" class="price-wrapper "><span class="price">$3.60</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-1056" onchange="updateQtyBasedOnTierPriceQty1056(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice1056() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.29,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "164028",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "1056",
"website_price": 3.86,
"price_incl_tax": 3.86,
"price_excl_tax": 3.86
}, {
"price_id": "164627",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "1056",
"website_price": 3.78,
"price_incl_tax": 3.78,
"price_excl_tax": 3.78
}, {
"price_id": "165130",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "1056",
"website_price": 3.69,
"price_incl_tax": 3.69,
"price_excl_tax": 3.69
}, {
"price_id": "165725",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "1056",
"website_price": 3.6,
"price_incl_tax": 3.6,
"price_excl_tax": 3.6
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-1056.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-1056.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice1056()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-1056" id="product-save-price-1056">
</span>
<span class="sd-price-without-discount-amount product-wod-price-1056" id="product-wod-price-1056">
</span>
<span class="price-label block"> </span>
<span id="product-price-1056" class="sd-unit-price product-price-1056">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.29</span> </span> / can </span>
<meta itemprop="price" content="4.29">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-1056" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-1056" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.29</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-1056" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-1056" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField1056 !== 'function') {
function initQtyField1056() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '1056',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField1056()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[1056]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[1056]" form="product_addtocart_form1056" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[1056] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-1056', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form1056" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/1055/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/1055/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form1055">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="1055">
<a href="https://snusdaddy.com/tiel-energy-sweet-elderflower" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-1055.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/t/i/tiel_sweet_elderflower_460x460.png" loading="lazy" width="240" height="300" alt="TIEL Energy Sweet Elderflower" title="TIEL Energy Sweet Elderflower">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> TIEL <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/tiel-energy-sweet-elderflower" :id="`slide-desc-1055-${$id('slider-id')}`" id="slide-desc-1055-slider-id-51">
Sweet Elderflower </a>
</div>
<div class="mg-per-pouch"> 0 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty1055 !== 'function') {
function updateQtyBasedOnTierPriceQty1055(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-1055');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[1055]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-1055');
const priceWods = document.getElementsByClassName('product-wod-price-1055');
const priceTotals = document.getElementsByClassName('sd-total-price-1055');
const pricePerCans = document.getElementsByClassName('product-price-1055');
let savePrice = 0;
let customTotalsPrice = 4.29;
var customPerItemPrice = 4.29;
if (qty >= 10) {
savePrice = qty * 0.43;
customTotalsPrice = parseFloat("3.86") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.86;
}
if (qty >= 30) {
savePrice = qty * 0.51;
customTotalsPrice = parseFloat("3.78") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.78;
}
if (qty >= 60) {
savePrice = qty * 0.6;
customTotalsPrice = parseFloat("3.69") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.69;
}
if (qty >= 100) {
savePrice = qty * 0.69;
customTotalsPrice = parseFloat("3.6") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3.6;
}
// Calculate the price
const wodPrice = qty * 4.29;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.29);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.29)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-1055 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-1055" onclick="updateQtyBasedOnTierPriceQty1055(this, 1)">
<span>1 can</span>
<span><span class="price">$4.29</span></span>
<span>(<span class="price">$4.29</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-1055" onclick="updateQtyBasedOnTierPriceQty1055(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="38.6" data-price-type="" class="price-wrapper "><span class="price">$38.60</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="3.86" data-price-type="" class="price-wrapper "><span class="price">$3.86</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-1055" onclick="updateQtyBasedOnTierPriceQty1055(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="113.4" data-price-type="" class="price-wrapper "><span class="price">$113.40</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="3.78" data-price-type="" class="price-wrapper "><span class="price">$3.78</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-1055" onclick="updateQtyBasedOnTierPriceQty1055(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="221.4" data-price-type="" class="price-wrapper "><span class="price">$221.40</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="3.69" data-price-type="" class="price-wrapper "><span class="price">$3.69</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-1055" onclick="updateQtyBasedOnTierPriceQty1055(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="360" data-price-type="" class="price-wrapper "><span class="price">$360.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="3.6" data-price-type="" class="price-wrapper "><span class="price">$3.60</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-1055" onchange="updateQtyBasedOnTierPriceQty1055(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice1055() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.29,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "164027",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "1055",
"website_price": 3.86,
"price_incl_tax": 3.86,
"price_excl_tax": 3.86
}, {
"price_id": "164626",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "1055",
"website_price": 3.78,
"price_incl_tax": 3.78,
"price_excl_tax": 3.78
}, {
"price_id": "165129",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "1055",
"website_price": 3.69,
"price_incl_tax": 3.69,
"price_excl_tax": 3.69
}, {
"price_id": "165724",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "1055",
"website_price": 3.6,
"price_incl_tax": 3.6,
"price_excl_tax": 3.6
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-1055.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-1055.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice1055()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-1055" id="product-save-price-1055">
</span>
<span class="sd-price-without-discount-amount product-wod-price-1055" id="product-wod-price-1055">
</span>
<span class="price-label block"> </span>
<span id="product-price-1055" class="sd-unit-price product-price-1055">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.29</span> </span> / can </span>
<meta itemprop="price" content="4.29">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-1055" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-1055" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.29</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-1055" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-1055" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField1055 !== 'function') {
function initQtyField1055() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '1055',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField1055()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[1055]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[1055]" form="product_addtocart_form1055" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[1055] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-1055', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form1055" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/1054/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/1054/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form1054">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="1054">
<a href="https://snusdaddy.com/goat-cool-mint-28" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-1054.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/g/o/goat_cool_mint_28_460x460.png" loading="lazy" width="240" height="300" alt="GOAT Cool Mint #28" title="GOAT Cool Mint #28">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> GOAT <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/goat-cool-mint-28" :id="`slide-desc-1054-${$id('slider-id')}`" id="slide-desc-1054-slider-id-52">
Cool Mint #28 </a>
</div>
<div class="mg-per-pouch"> 19.6 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty1054 !== 'function') {
function updateQtyBasedOnTierPriceQty1054(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-1054');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[1054]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-1054');
const priceWods = document.getElementsByClassName('product-wod-price-1054');
const priceTotals = document.getElementsByClassName('sd-total-price-1054');
const pricePerCans = document.getElementsByClassName('product-price-1054');
let savePrice = 0;
let customTotalsPrice = 4.29;
var customPerItemPrice = 4.29;
customTotalsPrice = 4.290000;
customPerItemPrice = 4.290000;
if (qty >= 1) {
savePrice = qty * 1.29; // zz
customTotalsPrice = parseFloat("3") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3;
}
if (qty >= 10) {
savePrice = qty * 1.29;
customTotalsPrice = parseFloat("3") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3;
}
if (qty >= 30) {
savePrice = qty * 1.29;
customTotalsPrice = parseFloat("3") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3;
}
if (qty >= 60) {
savePrice = qty * 1.29;
customTotalsPrice = parseFloat("3") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3;
}
if (qty >= 100) {
savePrice = qty * 1.29;
customTotalsPrice = parseFloat("3") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 3;
}
// Calculate the price
const wodPrice = qty * 4.29;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice >= 4.29);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.29)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-1054 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-1054" onclick="updateQtyBasedOnTierPriceQty1054(this, 1)">
<span>1 can</span>
<span><span class="price">$3.00</span></span>
<span>(<span class="price">$3.00</span> / can)</span>
<span class="percent tier-%3">30%</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-1054" onclick="updateQtyBasedOnTierPriceQty1054(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="30" data-price-type="" class="price-wrapper "><span class="price">$30.00</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="3" data-price-type="" class="price-wrapper "><span class="price">$3.00</span></span>
</span> / can)</span>
<span class="percent tier-%3">30%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-1054" onclick="updateQtyBasedOnTierPriceQty1054(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="90" data-price-type="" class="price-wrapper "><span class="price">$90.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="3" data-price-type="" class="price-wrapper "><span class="price">$3.00</span></span>
</span> / can)</span>
<span class="percent tier-%3">30%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-1054" onclick="updateQtyBasedOnTierPriceQty1054(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="180" data-price-type="" class="price-wrapper "><span class="price">$180.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="3" data-price-type="" class="price-wrapper "><span class="price">$3.00</span></span>
</span> / can)</span>
<span class="percent tier-%3">30%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-1054" onclick="updateQtyBasedOnTierPriceQty1054(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="300" data-price-type="" class="price-wrapper "><span class="price">$300.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="3" data-price-type="" class="price-wrapper "><span class="price">$3.00</span></span>
</span> / can)</span>
<span class="percent tier-%3">30%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-1054" onchange="updateQtyBasedOnTierPriceQty1054(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice1054() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 3,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "172766",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "30.00",
"product_id": "1054",
"website_price": 3,
"price_incl_tax": 3,
"price_excl_tax": 3
}, {
"price_id": "172767",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "30.00",
"product_id": "1054",
"website_price": 3,
"price_incl_tax": 3,
"price_excl_tax": 3
}, {
"price_id": "172807",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "30.00",
"product_id": "1054",
"website_price": 3,
"price_incl_tax": 3,
"price_excl_tax": 3
}, {
"price_id": "172808",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "30.00",
"product_id": "1054",
"website_price": 3,
"price_incl_tax": 3,
"price_excl_tax": 3
}],
showRegularPriceLabel: true,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-1054.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-1054.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice1054()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="old-price mr-2 flex" style="display: none;">
<span id="product-price-1054" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(4.29 + getCustomOptionPrice())">
<span class="price">$4.29</span> </span>
</span>
</div>
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-1054" id="product-save-price-1054">
</span>
<span class="sd-price-without-discount-amount product-wod-price-1054" id="product-wod-price-1054">
</span>
<span class="price-label block"> </span>
<span id="product-price-1054" class="sd-unit-price product-price-1054">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$3.00</span> </span> / can </span>
<meta itemprop="price" content="3">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-1054" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-1054" x-html="getFormattedFinalTotalPrice()">
<span class="price">$3.00</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-1054" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-1054" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField1054 !== 'function') {
function initQtyField1054() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '1054',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField1054()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[1054]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[1054]" form="product_addtocart_form1054" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[1054] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-1054', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form1054" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/1034/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/1034/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form1034">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="1034">
<a href="https://snusdaddy.com/zyn-mini-dry-black-licorice-3-mg" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-1034.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/b/l/black_licorice_mini_3_mg_460x460.png" loading="lazy" width="240" height="300" alt="ZYN Mini Dry Black Licorice 3 mg" title="ZYN Mini Dry Black Licorice 3 mg">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> ZYN <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/zyn-mini-dry-black-licorice-3-mg" :id="`slide-desc-1034-${$id('slider-id')}`" id="slide-desc-1034-slider-id-53">
Mini Dry Black Licorice 3 mg </a>
</div>
<div class="mg-per-pouch"> 3 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty1034 !== 'function') {
function updateQtyBasedOnTierPriceQty1034(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-1034');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[1034]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-1034');
const priceWods = document.getElementsByClassName('product-wod-price-1034');
const priceTotals = document.getElementsByClassName('sd-total-price-1034');
const pricePerCans = document.getElementsByClassName('product-price-1034');
let savePrice = 0;
let customTotalsPrice = 4.99;
var customPerItemPrice = 4.99;
if (qty >= 10) {
savePrice = qty * 0.5;
customTotalsPrice = parseFloat("4.49") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.49;
}
if (qty >= 30) {
savePrice = qty * 0.6;
customTotalsPrice = parseFloat("4.39") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.39;
}
if (qty >= 60) {
savePrice = qty * 0.7;
customTotalsPrice = parseFloat("4.29") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.29;
}
if (qty >= 100) {
savePrice = qty * 0.8;
customTotalsPrice = parseFloat("4.19") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.19;
}
// Calculate the price
const wodPrice = qty * 4.99;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.99);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.99)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-1034 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-1034" onclick="updateQtyBasedOnTierPriceQty1034(this, 1)">
<span>1 can</span>
<span><span class="price">$4.99</span></span>
<span>(<span class="price">$4.99</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-1034" onclick="updateQtyBasedOnTierPriceQty1034(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="44.9" data-price-type="" class="price-wrapper "><span class="price">$44.90</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="4.49" data-price-type="" class="price-wrapper "><span class="price">$4.49</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-1034" onclick="updateQtyBasedOnTierPriceQty1034(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="131.7" data-price-type="" class="price-wrapper "><span class="price">$131.70</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="4.39" data-price-type="" class="price-wrapper "><span class="price">$4.39</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-1034" onclick="updateQtyBasedOnTierPriceQty1034(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="257.4" data-price-type="" class="price-wrapper "><span class="price">$257.40</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="4.29" data-price-type="" class="price-wrapper "><span class="price">$4.29</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-1034" onclick="updateQtyBasedOnTierPriceQty1034(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="419" data-price-type="" class="price-wrapper "><span class="price">$419.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="4.19" data-price-type="" class="price-wrapper "><span class="price">$4.19</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-1034" onchange="updateQtyBasedOnTierPriceQty1034(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice1034() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.99,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "164226",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "1034",
"website_price": 4.49,
"price_incl_tax": 4.49,
"price_excl_tax": 4.49
}, {
"price_id": "164790",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "1034",
"website_price": 4.39,
"price_incl_tax": 4.39,
"price_excl_tax": 4.39
}, {
"price_id": "165354",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "1034",
"website_price": 4.29,
"price_incl_tax": 4.29,
"price_excl_tax": 4.29
}, {
"price_id": "165918",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "1034",
"website_price": 4.19,
"price_incl_tax": 4.19,
"price_excl_tax": 4.19
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-1034.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-1034.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice1034()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-1034" id="product-save-price-1034">
</span>
<span class="sd-price-without-discount-amount product-wod-price-1034" id="product-wod-price-1034">
</span>
<span class="price-label block"> </span>
<span id="product-price-1034" class="sd-unit-price product-price-1034">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.99</span> </span> / can </span>
<meta itemprop="price" content="4.99">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-1034" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-1034" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.99</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-1034" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-1034" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField1034 !== 'function') {
function initQtyField1034() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '1034',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField1034()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[1034]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[1034]" form="product_addtocart_form1034" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[1034] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-1034', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form1034" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/1033/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/1033/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form1033">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="1033">
<a href="https://snusdaddy.com/zyn-slim-red-fruit-regular" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-1033.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/s/l/slim_red_fruits_regular_460x460.png" loading="lazy" width="240" height="300" alt="ZYN Slim Red Fruit Regular" title="ZYN Slim Red Fruit Regular">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> ZYN <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/zyn-slim-red-fruit-regular" :id="`slide-desc-1033-${$id('slider-id')}`" id="slide-desc-1033-slider-id-54">
Slim Red Fruit Regular </a>
</div>
<div class="mg-per-pouch"> 6.6 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty1033 !== 'function') {
function updateQtyBasedOnTierPriceQty1033(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-1033');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[1033]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-1033');
const priceWods = document.getElementsByClassName('product-wod-price-1033');
const priceTotals = document.getElementsByClassName('sd-total-price-1033');
const pricePerCans = document.getElementsByClassName('product-price-1033');
let savePrice = 0;
let customTotalsPrice = 4.99;
var customPerItemPrice = 4.99;
if (qty >= 10) {
savePrice = qty * 0.5;
customTotalsPrice = parseFloat("4.49") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.49;
}
if (qty >= 30) {
savePrice = qty * 0.6;
customTotalsPrice = parseFloat("4.39") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.39;
}
if (qty >= 60) {
savePrice = qty * 0.7;
customTotalsPrice = parseFloat("4.29") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.29;
}
if (qty >= 100) {
savePrice = qty * 0.8;
customTotalsPrice = parseFloat("4.19") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.19;
}
// Calculate the price
const wodPrice = qty * 4.99;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.99);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.99)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-1033 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-1033" onclick="updateQtyBasedOnTierPriceQty1033(this, 1)">
<span>1 can</span>
<span><span class="price">$4.99</span></span>
<span>(<span class="price">$4.99</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-1033" onclick="updateQtyBasedOnTierPriceQty1033(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="44.9" data-price-type="" class="price-wrapper "><span class="price">$44.90</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="4.49" data-price-type="" class="price-wrapper "><span class="price">$4.49</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-1033" onclick="updateQtyBasedOnTierPriceQty1033(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="131.7" data-price-type="" class="price-wrapper "><span class="price">$131.70</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="4.39" data-price-type="" class="price-wrapper "><span class="price">$4.39</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-1033" onclick="updateQtyBasedOnTierPriceQty1033(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="257.4" data-price-type="" class="price-wrapper "><span class="price">$257.40</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="4.29" data-price-type="" class="price-wrapper "><span class="price">$4.29</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-1033" onclick="updateQtyBasedOnTierPriceQty1033(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="419" data-price-type="" class="price-wrapper "><span class="price">$419.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="4.19" data-price-type="" class="price-wrapper "><span class="price">$4.19</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-1033" onchange="updateQtyBasedOnTierPriceQty1033(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice1033() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.99,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "164267",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "1033",
"website_price": 4.49,
"price_incl_tax": 4.49,
"price_excl_tax": 4.49
}, {
"price_id": "164831",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "1033",
"website_price": 4.39,
"price_incl_tax": 4.39,
"price_excl_tax": 4.39
}, {
"price_id": "165395",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "1033",
"website_price": 4.29,
"price_incl_tax": 4.29,
"price_excl_tax": 4.29
}, {
"price_id": "165959",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "1033",
"website_price": 4.19,
"price_incl_tax": 4.19,
"price_excl_tax": 4.19
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-1033.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-1033.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice1033()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-1033" id="product-save-price-1033">
</span>
<span class="sd-price-without-discount-amount product-wod-price-1033" id="product-wod-price-1033">
</span>
<span class="price-label block"> </span>
<span id="product-price-1033" class="sd-unit-price product-price-1033">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.99</span> </span> / can </span>
<meta itemprop="price" content="4.99">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-1033" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-1033" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.99</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-1033" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-1033" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField1033 !== 'function') {
function initQtyField1033() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '1033',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField1033()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[1033]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[1033]" form="product_addtocart_form1033" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[1033] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-1033', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form1033" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/1032/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/1032/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form1032">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="1032">
<a href="https://snusdaddy.com/velo-frosty-lemon" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-1032.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/f/r/frosty_lemon_460x460.png" loading="lazy" width="240" height="300" alt="VELO Frosty Lemon" title="VELO Frosty Lemon">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> VELO <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/velo-frosty-lemon" :id="`slide-desc-1032-${$id('slider-id')}`" id="slide-desc-1032-slider-id-55">
Frosty Lemon </a>
</div>
<div class="mg-per-pouch"> 10 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty1032 !== 'function') {
function updateQtyBasedOnTierPriceQty1032(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-1032');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[1032]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-1032');
const priceWods = document.getElementsByClassName('product-wod-price-1032');
const priceTotals = document.getElementsByClassName('sd-total-price-1032');
const pricePerCans = document.getElementsByClassName('product-price-1032');
let savePrice = 0;
let customTotalsPrice = 5.19;
var customPerItemPrice = 5.19;
if (qty >= 10) {
savePrice = qty * 0.52;
customTotalsPrice = parseFloat("4.67") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.67;
}
if (qty >= 30) {
savePrice = qty * 0.62;
customTotalsPrice = parseFloat("4.57") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.57;
}
if (qty >= 60) {
savePrice = qty * 0.73;
customTotalsPrice = parseFloat("4.46") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.46;
}
if (qty >= 100) {
savePrice = qty * 0.83;
customTotalsPrice = parseFloat("4.36") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.36;
}
// Calculate the price
const wodPrice = qty * 5.19;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 5.19);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 5.19)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-1032 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-1032" onclick="updateQtyBasedOnTierPriceQty1032(this, 1)">
<span>1 can</span>
<span><span class="price">$5.19</span></span>
<span>(<span class="price">$5.19</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-1032" onclick="updateQtyBasedOnTierPriceQty1032(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="46.7" data-price-type="" class="price-wrapper "><span class="price">$46.70</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="4.67" data-price-type="" class="price-wrapper "><span class="price">$4.67</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-1032" onclick="updateQtyBasedOnTierPriceQty1032(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="137.1" data-price-type="" class="price-wrapper "><span class="price">$137.10</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="4.57" data-price-type="" class="price-wrapper "><span class="price">$4.57</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-1032" onclick="updateQtyBasedOnTierPriceQty1032(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="267.6" data-price-type="" class="price-wrapper "><span class="price">$267.60</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="4.46" data-price-type="" class="price-wrapper "><span class="price">$4.46</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-1032" onclick="updateQtyBasedOnTierPriceQty1032(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="436" data-price-type="" class="price-wrapper "><span class="price">$436.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="4.36" data-price-type="" class="price-wrapper "><span class="price">$4.36</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-1032" onchange="updateQtyBasedOnTierPriceQty1032(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice1032() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 5.19,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "164052",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "1032",
"website_price": 4.67,
"price_incl_tax": 4.67,
"price_excl_tax": 4.67
}, {
"price_id": "164651",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "1032",
"website_price": 4.57,
"price_incl_tax": 4.57,
"price_excl_tax": 4.57
}, {
"price_id": "165230",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "1032",
"website_price": 4.46,
"price_incl_tax": 4.46,
"price_excl_tax": 4.46
}, {
"price_id": "165749",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "1032",
"website_price": 4.36,
"price_incl_tax": 4.36,
"price_excl_tax": 4.36
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-1032.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-1032.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice1032()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-1032" id="product-save-price-1032">
</span>
<span class="sd-price-without-discount-amount product-wod-price-1032" id="product-wod-price-1032">
</span>
<span class="price-label block"> </span>
<span id="product-price-1032" class="sd-unit-price product-price-1032">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$5.19</span> </span> / can </span>
<meta itemprop="price" content="5.19">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-1032" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-1032" x-html="getFormattedFinalTotalPrice()">
<span class="price">$5.19</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-1032" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-1032" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField1032 !== 'function') {
function initQtyField1032() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '1032',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField1032()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[1032]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[1032]" form="product_addtocart_form1032" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[1032] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-1032', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form1032" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/1031/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/1031/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form1031">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="1031">
<a href="https://snusdaddy.com/velo-wintery-watermelon" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-1031.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/w/i/wintery_watermelon_460x460.png" loading="lazy" width="240" height="300" alt="VELO Wintery Watermelon " title="VELO Wintery Watermelon ">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> VELO <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/velo-wintery-watermelon" :id="`slide-desc-1031-${$id('slider-id')}`" id="slide-desc-1031-slider-id-56">
Wintery Watermelon </a>
</div>
<div class="mg-per-pouch"> 10 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty1031 !== 'function') {
function updateQtyBasedOnTierPriceQty1031(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-1031');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[1031]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-1031');
const priceWods = document.getElementsByClassName('product-wod-price-1031');
const priceTotals = document.getElementsByClassName('sd-total-price-1031');
const pricePerCans = document.getElementsByClassName('product-price-1031');
let savePrice = 0;
let customTotalsPrice = 5.19;
var customPerItemPrice = 5.19;
if (qty >= 10) {
savePrice = qty * 0.52;
customTotalsPrice = parseFloat("4.67") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.67;
}
if (qty >= 30) {
savePrice = qty * 0.62;
customTotalsPrice = parseFloat("4.57") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.57;
}
if (qty >= 60) {
savePrice = qty * 0.73;
customTotalsPrice = parseFloat("4.46") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.46;
}
if (qty >= 100) {
savePrice = qty * 0.83;
customTotalsPrice = parseFloat("4.36") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.36;
}
// Calculate the price
const wodPrice = qty * 5.19;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 5.19);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 5.19)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-1031 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-1031" onclick="updateQtyBasedOnTierPriceQty1031(this, 1)">
<span>1 can</span>
<span><span class="price">$5.19</span></span>
<span>(<span class="price">$5.19</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-1031" onclick="updateQtyBasedOnTierPriceQty1031(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="46.7" data-price-type="" class="price-wrapper "><span class="price">$46.70</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="4.67" data-price-type="" class="price-wrapper "><span class="price">$4.67</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-1031" onclick="updateQtyBasedOnTierPriceQty1031(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="137.1" data-price-type="" class="price-wrapper "><span class="price">$137.10</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="4.57" data-price-type="" class="price-wrapper "><span class="price">$4.57</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-1031" onclick="updateQtyBasedOnTierPriceQty1031(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="267.6" data-price-type="" class="price-wrapper "><span class="price">$267.60</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="4.46" data-price-type="" class="price-wrapper "><span class="price">$4.46</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-1031" onclick="updateQtyBasedOnTierPriceQty1031(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="436" data-price-type="" class="price-wrapper "><span class="price">$436.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="4.36" data-price-type="" class="price-wrapper "><span class="price">$4.36</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-1031" onchange="updateQtyBasedOnTierPriceQty1031(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice1031() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 5.19,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "164146",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "1031",
"website_price": 4.67,
"price_incl_tax": 4.67,
"price_excl_tax": 4.67
}, {
"price_id": "164710",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "1031",
"website_price": 4.57,
"price_incl_tax": 4.57,
"price_excl_tax": 4.57
}, {
"price_id": "165274",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "1031",
"website_price": 4.46,
"price_incl_tax": 4.46,
"price_excl_tax": 4.46
}, {
"price_id": "165838",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "1031",
"website_price": 4.36,
"price_incl_tax": 4.36,
"price_excl_tax": 4.36
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-1031.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-1031.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice1031()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-1031" id="product-save-price-1031">
</span>
<span class="sd-price-without-discount-amount product-wod-price-1031" id="product-wod-price-1031">
</span>
<span class="price-label block"> </span>
<span id="product-price-1031" class="sd-unit-price product-price-1031">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$5.19</span> </span> / can </span>
<meta itemprop="price" content="5.19">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-1031" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-1031" x-html="getFormattedFinalTotalPrice()">
<span class="price">$5.19</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-1031" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-1031" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField1031 !== 'function') {
function initQtyField1031() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '1031',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField1031()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[1031]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[1031]" form="product_addtocart_form1031" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[1031] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-1031', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form1031" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/1030/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/1030/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form1030">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="1030">
<a href="https://snusdaddy.com/velo-rich-elaichi" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-1030.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/r/i/rich_elaichi_460x460.png" loading="lazy" width="240" height="300" alt="VELO Rich Elaichi " title="VELO Rich Elaichi ">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> VELO <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/velo-rich-elaichi" :id="`slide-desc-1030-${$id('slider-id')}`" id="slide-desc-1030-slider-id-57">
Rich Elaichi </a>
</div>
<div class="mg-per-pouch"> 10 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty1030 !== 'function') {
function updateQtyBasedOnTierPriceQty1030(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-1030');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[1030]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-1030');
const priceWods = document.getElementsByClassName('product-wod-price-1030');
const priceTotals = document.getElementsByClassName('sd-total-price-1030');
const pricePerCans = document.getElementsByClassName('product-price-1030');
let savePrice = 0;
let customTotalsPrice = 5.19;
var customPerItemPrice = 5.19;
if (qty >= 10) {
savePrice = qty * 0.52;
customTotalsPrice = parseFloat("4.67") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.67;
}
if (qty >= 30) {
savePrice = qty * 0.62;
customTotalsPrice = parseFloat("4.57") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.57;
}
if (qty >= 60) {
savePrice = qty * 0.73;
customTotalsPrice = parseFloat("4.46") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.46;
}
if (qty >= 100) {
savePrice = qty * 0.83;
customTotalsPrice = parseFloat("4.36") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.36;
}
// Calculate the price
const wodPrice = qty * 5.19;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 5.19);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 5.19)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-1030 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-1030" onclick="updateQtyBasedOnTierPriceQty1030(this, 1)">
<span>1 can</span>
<span><span class="price">$5.19</span></span>
<span>(<span class="price">$5.19</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-1030" onclick="updateQtyBasedOnTierPriceQty1030(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="46.7" data-price-type="" class="price-wrapper "><span class="price">$46.70</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="4.67" data-price-type="" class="price-wrapper "><span class="price">$4.67</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-1030" onclick="updateQtyBasedOnTierPriceQty1030(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="137.1" data-price-type="" class="price-wrapper "><span class="price">$137.10</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="4.57" data-price-type="" class="price-wrapper "><span class="price">$4.57</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-1030" onclick="updateQtyBasedOnTierPriceQty1030(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="267.6" data-price-type="" class="price-wrapper "><span class="price">$267.60</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="4.46" data-price-type="" class="price-wrapper "><span class="price">$4.46</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-1030" onclick="updateQtyBasedOnTierPriceQty1030(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="436" data-price-type="" class="price-wrapper "><span class="price">$436.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="4.36" data-price-type="" class="price-wrapper "><span class="price">$4.36</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-1030" onchange="updateQtyBasedOnTierPriceQty1030(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice1030() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 5.19,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "164129",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "1030",
"website_price": 4.67,
"price_incl_tax": 4.67,
"price_excl_tax": 4.67
}, {
"price_id": "164678",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "1030",
"website_price": 4.57,
"price_incl_tax": 4.57,
"price_excl_tax": 4.57
}, {
"price_id": "165257",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "1030",
"website_price": 4.46,
"price_incl_tax": 4.46,
"price_excl_tax": 4.46
}, {
"price_id": "165821",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "1030",
"website_price": 4.36,
"price_incl_tax": 4.36,
"price_excl_tax": 4.36
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-1030.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-1030.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice1030()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-1030" id="product-save-price-1030">
</span>
<span class="sd-price-without-discount-amount product-wod-price-1030" id="product-wod-price-1030">
</span>
<span class="price-label block"> </span>
<span id="product-price-1030" class="sd-unit-price product-price-1030">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$5.19</span> </span> / can </span>
<meta itemprop="price" content="5.19">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-1030" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-1030" x-html="getFormattedFinalTotalPrice()">
<span class="price">$5.19</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-1030" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-1030" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField1030 !== 'function') {
function initQtyField1030() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '1030',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField1030()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[1030]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[1030]" form="product_addtocart_form1030" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[1030] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-1030', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form1030" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/651/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/651/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form651">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="651">
<a href="https://snusdaddy.com/zyn-mini-black-cherry-6-mg" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-651.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/b/l/black_cherry_strong_460x460.png" loading="lazy" width="240" height="300" alt="ZYN Mini Black Cherry 6 mg Product Label" title="ZYN Mini Black Cherry 6 mg Product Label">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> ZYN <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 4.7 </div>
<div class="sd-star-green"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/zyn-mini-black-cherry-6-mg" :id="`slide-desc-651-${$id('slider-id')}`">
Mini Dry Black Cherry 6 mg </a>
</div>
<div class="mg-per-pouch"> 6 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty651 !== 'function') {
function updateQtyBasedOnTierPriceQty651(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-651');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[651]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-651');
const priceWods = document.getElementsByClassName('product-wod-price-651');
const priceTotals = document.getElementsByClassName('sd-total-price-651');
const pricePerCans = document.getElementsByClassName('product-price-651');
let savePrice = 0;
let customTotalsPrice = 4.99;
var customPerItemPrice = 4.99;
if (qty >= 10) {
savePrice = qty * 0.5;
customTotalsPrice = parseFloat("4.49") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.49;
}
if (qty >= 30) {
savePrice = qty * 0.6;
customTotalsPrice = parseFloat("4.39") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.39;
}
if (qty >= 60) {
savePrice = qty * 0.7;
customTotalsPrice = parseFloat("4.29") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.29;
}
if (qty >= 100) {
savePrice = qty * 0.8;
customTotalsPrice = parseFloat("4.19") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.19;
}
// Calculate the price
const wodPrice = qty * 4.99;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.99);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.99)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-651 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-651" onclick="updateQtyBasedOnTierPriceQty651(this, 1)">
<span>1 can</span>
<span><span class="price">$4.99</span></span>
<span>(<span class="price">$4.99</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-651" onclick="updateQtyBasedOnTierPriceQty651(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="44.9" data-price-type="" class="price-wrapper "><span class="price">$44.90</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="4.49" data-price-type="" class="price-wrapper "><span class="price">$4.49</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-651" onclick="updateQtyBasedOnTierPriceQty651(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="131.7" data-price-type="" class="price-wrapper "><span class="price">$131.70</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="4.39" data-price-type="" class="price-wrapper "><span class="price">$4.39</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-651" onclick="updateQtyBasedOnTierPriceQty651(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="257.4" data-price-type="" class="price-wrapper "><span class="price">$257.40</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="4.29" data-price-type="" class="price-wrapper "><span class="price">$4.29</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-651" onclick="updateQtyBasedOnTierPriceQty651(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="419" data-price-type="" class="price-wrapper "><span class="price">$419.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="4.19" data-price-type="" class="price-wrapper "><span class="price">$4.19</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-651" onchange="updateQtyBasedOnTierPriceQty651(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice651() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.99,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "164225",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "651",
"website_price": 4.49,
"price_incl_tax": 4.49,
"price_excl_tax": 4.49
}, {
"price_id": "164789",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "651",
"website_price": 4.39,
"price_incl_tax": 4.39,
"price_excl_tax": 4.39
}, {
"price_id": "165353",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "651",
"website_price": 4.29,
"price_incl_tax": 4.29,
"price_excl_tax": 4.29
}, {
"price_id": "165917",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "651",
"website_price": 4.19,
"price_incl_tax": 4.19,
"price_excl_tax": 4.19
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-651.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-651.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice651()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-651" id="product-save-price-651">
</span>
<span class="sd-price-without-discount-amount product-wod-price-651" id="product-wod-price-651">
</span>
<span class="price-label block"> </span>
<span id="product-price-651" class="sd-unit-price product-price-651">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.99</span> </span> / can </span>
<meta itemprop="price" content="4.99">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-651" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-651" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.99</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-651" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-651" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField651 !== 'function') {
function initQtyField651() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '651',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField651()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[651]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[651]" form="product_addtocart_form651" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[651] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-651', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form651" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/122/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/122/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form122">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="122">
<a href="https://snusdaddy.com/zyn-bellini-mini-dry-3-mg" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-122.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/b/e/bellini_460x460.png" loading="lazy" width="240" height="300" alt="ZYN Mini Dry Bellini 3 mg Product Label" title="ZYN Mini Dry Bellini 3 mg Product Label">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> ZYN <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 4.6 </div>
<div class="sd-star-green"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/zyn-bellini-mini-dry-3-mg" :id="`slide-desc-122-${$id('slider-id')}`">
Mini Bellini 3 mg </a>
</div>
<div class="mg-per-pouch"> 3 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty122 !== 'function') {
function updateQtyBasedOnTierPriceQty122(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-122');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[122]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-122');
const priceWods = document.getElementsByClassName('product-wod-price-122');
const priceTotals = document.getElementsByClassName('sd-total-price-122');
const pricePerCans = document.getElementsByClassName('product-price-122');
let savePrice = 0;
let customTotalsPrice = 4.99;
var customPerItemPrice = 4.99;
if (qty >= 10) {
savePrice = qty * 0.5;
customTotalsPrice = parseFloat("4.49") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.49;
}
if (qty >= 30) {
savePrice = qty * 0.6;
customTotalsPrice = parseFloat("4.39") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.39;
}
if (qty >= 60) {
savePrice = qty * 0.7;
customTotalsPrice = parseFloat("4.29") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.29;
}
if (qty >= 100) {
savePrice = qty * 0.8;
customTotalsPrice = parseFloat("4.19") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.19;
}
// Calculate the price
const wodPrice = qty * 4.99;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.99);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.99)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-122 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-122" onclick="updateQtyBasedOnTierPriceQty122(this, 1)">
<span>1 can</span>
<span><span class="price">$4.99</span></span>
<span>(<span class="price">$4.99</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-122" onclick="updateQtyBasedOnTierPriceQty122(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="44.9" data-price-type="" class="price-wrapper "><span class="price">$44.90</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="4.49" data-price-type="" class="price-wrapper "><span class="price">$4.49</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-122" onclick="updateQtyBasedOnTierPriceQty122(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="131.7" data-price-type="" class="price-wrapper "><span class="price">$131.70</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="4.39" data-price-type="" class="price-wrapper "><span class="price">$4.39</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-122" onclick="updateQtyBasedOnTierPriceQty122(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="257.4" data-price-type="" class="price-wrapper "><span class="price">$257.40</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="4.29" data-price-type="" class="price-wrapper "><span class="price">$4.29</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-122" onclick="updateQtyBasedOnTierPriceQty122(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="419" data-price-type="" class="price-wrapper "><span class="price">$419.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="4.19" data-price-type="" class="price-wrapper "><span class="price">$4.19</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-122" onchange="updateQtyBasedOnTierPriceQty122(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice122() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.99,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "164222",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "122",
"website_price": 4.49,
"price_incl_tax": 4.49,
"price_excl_tax": 4.49
}, {
"price_id": "164786",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "122",
"website_price": 4.39,
"price_incl_tax": 4.39,
"price_excl_tax": 4.39
}, {
"price_id": "165350",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "122",
"website_price": 4.29,
"price_incl_tax": 4.29,
"price_excl_tax": 4.29
}, {
"price_id": "165914",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "122",
"website_price": 4.19,
"price_incl_tax": 4.19,
"price_excl_tax": 4.19
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-122.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-122.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice122()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-122" id="product-save-price-122">
</span>
<span class="sd-price-without-discount-amount product-wod-price-122" id="product-wod-price-122">
</span>
<span class="price-label block"> </span>
<span id="product-price-122" class="sd-unit-price product-price-122">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.99</span> </span> / can </span>
<meta itemprop="price" content="4.99">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-122" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-122" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.99</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-122" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-122" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField122 !== 'function') {
function initQtyField122() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '122',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField122()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[122]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[122]" form="product_addtocart_form122" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[122] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-122', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form122" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/78/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/78/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form78">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="78">
<a href="https://snusdaddy.com/zyn-mini-dry-citrus-3-mg" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-78.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/c/i/citrus_460x460.png" loading="lazy" width="240" height="300" alt="ZYN Mini Dry Citrus snus can at Snusdaddy.com" title="ZYN Mini Dry Citrus snus can at Snusdaddy.com">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> ZYN <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 5 </div>
<div class="sd-star-green"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/zyn-mini-dry-citrus-3-mg" :id="`slide-desc-78-${$id('slider-id')}`">
Mini Citrus 3 mg </a>
</div>
<div class="mg-per-pouch"> 3 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty78 !== 'function') {
function updateQtyBasedOnTierPriceQty78(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-78');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[78]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-78');
const priceWods = document.getElementsByClassName('product-wod-price-78');
const priceTotals = document.getElementsByClassName('sd-total-price-78');
const pricePerCans = document.getElementsByClassName('product-price-78');
let savePrice = 0;
let customTotalsPrice = 4.99;
var customPerItemPrice = 4.99;
if (qty >= 10) {
savePrice = qty * 0.5;
customTotalsPrice = parseFloat("4.49") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.49;
}
if (qty >= 30) {
savePrice = qty * 0.6;
customTotalsPrice = parseFloat("4.39") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.39;
}
if (qty >= 60) {
savePrice = qty * 0.7;
customTotalsPrice = parseFloat("4.29") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.29;
}
if (qty >= 100) {
savePrice = qty * 0.8;
customTotalsPrice = parseFloat("4.19") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.19;
}
// Calculate the price
const wodPrice = qty * 4.99;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.99);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.99)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-78 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-78" onclick="updateQtyBasedOnTierPriceQty78(this, 1)">
<span>1 can</span>
<span><span class="price">$4.99</span></span>
<span>(<span class="price">$4.99</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-78" onclick="updateQtyBasedOnTierPriceQty78(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="44.9" data-price-type="" class="price-wrapper "><span class="price">$44.90</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="4.49" data-price-type="" class="price-wrapper "><span class="price">$4.49</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-78" onclick="updateQtyBasedOnTierPriceQty78(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="131.7" data-price-type="" class="price-wrapper "><span class="price">$131.70</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="4.39" data-price-type="" class="price-wrapper "><span class="price">$4.39</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-78" onclick="updateQtyBasedOnTierPriceQty78(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="257.4" data-price-type="" class="price-wrapper "><span class="price">$257.40</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="4.29" data-price-type="" class="price-wrapper "><span class="price">$4.29</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-78" onclick="updateQtyBasedOnTierPriceQty78(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="419" data-price-type="" class="price-wrapper "><span class="price">$419.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="4.19" data-price-type="" class="price-wrapper "><span class="price">$4.19</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-78" onchange="updateQtyBasedOnTierPriceQty78(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice78() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.99,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "164227",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "78",
"website_price": 4.49,
"price_incl_tax": 4.49,
"price_excl_tax": 4.49
}, {
"price_id": "164791",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "78",
"website_price": 4.39,
"price_incl_tax": 4.39,
"price_excl_tax": 4.39
}, {
"price_id": "165355",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "78",
"website_price": 4.29,
"price_incl_tax": 4.29,
"price_excl_tax": 4.29
}, {
"price_id": "165919",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "78",
"website_price": 4.19,
"price_incl_tax": 4.19,
"price_excl_tax": 4.19
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-78.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-78.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice78()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-78" id="product-save-price-78">
</span>
<span class="sd-price-without-discount-amount product-wod-price-78" id="product-wod-price-78">
</span>
<span class="price-label block"> </span>
<span id="product-price-78" class="sd-unit-price product-price-78">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.99</span> </span> / can </span>
<meta itemprop="price" content="4.99">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-78" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-78" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.99</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-78" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-78" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField78 !== 'function') {
function initQtyField78() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '78',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField78()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[78]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[78]" form="product_addtocart_form78" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[78] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-78', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form78" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/75/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/75/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form75">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="75">
<a href="https://snusdaddy.com/zyn-mini-dry-espressino-3-mg" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-75.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/e/s/espressino_460x460.png" loading="lazy" width="240" height="300" alt="ZYN Mini Dry Espressino snus can at Snusdaddy.com" title="ZYN Mini Dry Espressino snus can at Snusdaddy.com">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> ZYN <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 5 </div>
<div class="sd-star-green"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/zyn-mini-dry-espressino-3-mg" :id="`slide-desc-75-${$id('slider-id')}`">
Mini Espressino 3 mg </a>
</div>
<div class="mg-per-pouch"> 3 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty75 !== 'function') {
function updateQtyBasedOnTierPriceQty75(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-75');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[75]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-75');
const priceWods = document.getElementsByClassName('product-wod-price-75');
const priceTotals = document.getElementsByClassName('sd-total-price-75');
const pricePerCans = document.getElementsByClassName('product-price-75');
let savePrice = 0;
let customTotalsPrice = 4.99;
var customPerItemPrice = 4.99;
if (qty >= 10) {
savePrice = qty * 0.5;
customTotalsPrice = parseFloat("4.49") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.49;
}
if (qty >= 30) {
savePrice = qty * 0.6;
customTotalsPrice = parseFloat("4.39") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.39;
}
if (qty >= 60) {
savePrice = qty * 0.7;
customTotalsPrice = parseFloat("4.29") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.29;
}
if (qty >= 100) {
savePrice = qty * 0.8;
customTotalsPrice = parseFloat("4.19") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.19;
}
// Calculate the price
const wodPrice = qty * 4.99;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.99);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.99)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-75 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-75" onclick="updateQtyBasedOnTierPriceQty75(this, 1)">
<span>1 can</span>
<span><span class="price">$4.99</span></span>
<span>(<span class="price">$4.99</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-75" onclick="updateQtyBasedOnTierPriceQty75(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="44.9" data-price-type="" class="price-wrapper "><span class="price">$44.90</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="4.49" data-price-type="" class="price-wrapper "><span class="price">$4.49</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-75" onclick="updateQtyBasedOnTierPriceQty75(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="131.7" data-price-type="" class="price-wrapper "><span class="price">$131.70</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="4.39" data-price-type="" class="price-wrapper "><span class="price">$4.39</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-75" onclick="updateQtyBasedOnTierPriceQty75(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="257.4" data-price-type="" class="price-wrapper "><span class="price">$257.40</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="4.29" data-price-type="" class="price-wrapper "><span class="price">$4.29</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-75" onclick="updateQtyBasedOnTierPriceQty75(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="419" data-price-type="" class="price-wrapper "><span class="price">$419.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="4.19" data-price-type="" class="price-wrapper "><span class="price">$4.19</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-75" onchange="updateQtyBasedOnTierPriceQty75(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice75() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.99,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "164232",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "75",
"website_price": 4.49,
"price_incl_tax": 4.49,
"price_excl_tax": 4.49
}, {
"price_id": "164796",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "75",
"website_price": 4.39,
"price_incl_tax": 4.39,
"price_excl_tax": 4.39
}, {
"price_id": "165360",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "75",
"website_price": 4.29,
"price_incl_tax": 4.29,
"price_excl_tax": 4.29
}, {
"price_id": "165924",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "75",
"website_price": 4.19,
"price_incl_tax": 4.19,
"price_excl_tax": 4.19
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-75.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-75.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice75()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-75" id="product-save-price-75">
</span>
<span class="sd-price-without-discount-amount product-wod-price-75" id="product-wod-price-75">
</span>
<span class="price-label block"> </span>
<span id="product-price-75" class="sd-unit-price product-price-75">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.99</span> </span> / can </span>
<meta itemprop="price" content="4.99">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-75" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-75" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.99</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-75" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-75" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField75 !== 'function') {
function initQtyField75() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '75',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField75()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[75]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[75]" form="product_addtocart_form75" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[75] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-75', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form75" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/1043/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/1043/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form1043">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="1043">
<a href="https://snusdaddy.com/zyn-mini-fresh-mint" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-1043.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/z/y/zyn_fresh_mint_mini_460x460.png" loading="lazy" width="240" height="300" alt="ZYN Mini Fresh Mint" title="ZYN Mini Fresh Mint">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> ZYN <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/zyn-mini-fresh-mint" :id="`slide-desc-1043-${$id('slider-id')}`">
Mini Fresh Mint </a>
</div>
<div class="mg-per-pouch"> 3.5 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty1043 !== 'function') {
function updateQtyBasedOnTierPriceQty1043(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-1043');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[1043]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-1043');
const priceWods = document.getElementsByClassName('product-wod-price-1043');
const priceTotals = document.getElementsByClassName('sd-total-price-1043');
const pricePerCans = document.getElementsByClassName('product-price-1043');
let savePrice = 0;
let customTotalsPrice = 4.99;
var customPerItemPrice = 4.99;
if (qty >= 10) {
savePrice = qty * 0.5;
customTotalsPrice = parseFloat("4.49") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.49;
}
if (qty >= 30) {
savePrice = qty * 0.6;
customTotalsPrice = parseFloat("4.39") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.39;
}
if (qty >= 60) {
savePrice = qty * 0.7;
customTotalsPrice = parseFloat("4.29") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.29;
}
if (qty >= 100) {
savePrice = qty * 0.8;
customTotalsPrice = parseFloat("4.19") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.19;
}
// Calculate the price
const wodPrice = qty * 4.99;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.99);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.99)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-1043 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-1043" onclick="updateQtyBasedOnTierPriceQty1043(this, 1)">
<span>1 can</span>
<span><span class="price">$4.99</span></span>
<span>(<span class="price">$4.99</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-1043" onclick="updateQtyBasedOnTierPriceQty1043(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="44.9" data-price-type="" class="price-wrapper "><span class="price">$44.90</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="4.49" data-price-type="" class="price-wrapper "><span class="price">$4.49</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-1043" onclick="updateQtyBasedOnTierPriceQty1043(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="131.7" data-price-type="" class="price-wrapper "><span class="price">$131.70</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="4.39" data-price-type="" class="price-wrapper "><span class="price">$4.39</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-1043" onclick="updateQtyBasedOnTierPriceQty1043(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="257.4" data-price-type="" class="price-wrapper "><span class="price">$257.40</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="4.29" data-price-type="" class="price-wrapper "><span class="price">$4.29</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-1043" onclick="updateQtyBasedOnTierPriceQty1043(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="419" data-price-type="" class="price-wrapper "><span class="price">$419.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="4.19" data-price-type="" class="price-wrapper "><span class="price">$4.19</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-1043" onchange="updateQtyBasedOnTierPriceQty1043(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice1043() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.99,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "164241",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "1043",
"website_price": 4.49,
"price_incl_tax": 4.49,
"price_excl_tax": 4.49
}, {
"price_id": "164805",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "1043",
"website_price": 4.39,
"price_incl_tax": 4.39,
"price_excl_tax": 4.39
}, {
"price_id": "165369",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "1043",
"website_price": 4.29,
"price_incl_tax": 4.29,
"price_excl_tax": 4.29
}, {
"price_id": "165933",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "1043",
"website_price": 4.19,
"price_incl_tax": 4.19,
"price_excl_tax": 4.19
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-1043.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-1043.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice1043()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-1043" id="product-save-price-1043">
</span>
<span class="sd-price-without-discount-amount product-wod-price-1043" id="product-wod-price-1043">
</span>
<span class="price-label block"> </span>
<span id="product-price-1043" class="sd-unit-price product-price-1043">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.99</span> </span> / can </span>
<meta itemprop="price" content="4.99">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-1043" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-1043" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.99</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-1043" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-1043" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField1043 !== 'function') {
function initQtyField1043() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '1043',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField1043()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[1043]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[1043]" form="product_addtocart_form1043" type="number" pattern="[0-9]{0,2}" inputmode="numeric" min="1" max="30" :value="qty"
class="qty[1043] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-1043', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form1043" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/81/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/81/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form81">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="81">
<a href="https://snusdaddy.com/zyn-mini-dry-cool-mint-6-mg" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-81.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/c/o/cool_mint_strong_460x460.png" loading="lazy" width="240" height="300" alt="ZYN Mini Dry Cool Mint Extra Strong snus can at Snusdaddy.com" title="ZYN Mini Dry Cool Mint Extra Strong snus can at Snusdaddy.com">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> ZYN <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 4.5 </div>
<div class="sd-star-green"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/zyn-mini-dry-cool-mint-6-mg" :id="`slide-desc-81-${$id('slider-id')}`">
Mini Cool Mint 6 mg </a>
</div>
<div class="mg-per-pouch"> 6 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty81 !== 'function') {
function updateQtyBasedOnTierPriceQty81(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-81');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[81]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-81');
const priceWods = document.getElementsByClassName('product-wod-price-81');
const priceTotals = document.getElementsByClassName('sd-total-price-81');
const pricePerCans = document.getElementsByClassName('product-price-81');
let savePrice = 0;
let customTotalsPrice = 4.99;
var customPerItemPrice = 4.99;
if (qty >= 10) {
savePrice = qty * 0.5;
customTotalsPrice = parseFloat("4.49") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.49;
}
if (qty >= 30) {
savePrice = qty * 0.6;
customTotalsPrice = parseFloat("4.39") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.39;
}
if (qty >= 60) {
savePrice = qty * 0.7;
customTotalsPrice = parseFloat("4.29") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.29;
}
if (qty >= 100) {
savePrice = qty * 0.8;
customTotalsPrice = parseFloat("4.19") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.19;
}
// Calculate the price
const wodPrice = qty * 4.99;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.99);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.99)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-81 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-81" onclick="updateQtyBasedOnTierPriceQty81(this, 1)">
<span>1 can</span>
<span><span class="price">$4.99</span></span>
<span>(<span class="price">$4.99</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-81" onclick="updateQtyBasedOnTierPriceQty81(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="44.9" data-price-type="" class="price-wrapper "><span class="price">$44.90</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="4.49" data-price-type="" class="price-wrapper "><span class="price">$4.49</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-81" onclick="updateQtyBasedOnTierPriceQty81(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="131.7" data-price-type="" class="price-wrapper "><span class="price">$131.70</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="4.39" data-price-type="" class="price-wrapper "><span class="price">$4.39</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-81" onclick="updateQtyBasedOnTierPriceQty81(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="257.4" data-price-type="" class="price-wrapper "><span class="price">$257.40</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="4.29" data-price-type="" class="price-wrapper "><span class="price">$4.29</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-81" onclick="updateQtyBasedOnTierPriceQty81(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="419" data-price-type="" class="price-wrapper "><span class="price">$419.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="4.19" data-price-type="" class="price-wrapper "><span class="price">$4.19</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-81" onchange="updateQtyBasedOnTierPriceQty81(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice81() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.99,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "164230",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "81",
"website_price": 4.49,
"price_incl_tax": 4.49,
"price_excl_tax": 4.49
}, {
"price_id": "164794",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "81",
"website_price": 4.39,
"price_incl_tax": 4.39,
"price_excl_tax": 4.39
}, {
"price_id": "165358",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "81",
"website_price": 4.29,
"price_incl_tax": 4.29,
"price_excl_tax": 4.29
}, {
"price_id": "165922",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "81",
"website_price": 4.19,
"price_incl_tax": 4.19,
"price_excl_tax": 4.19
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-81.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-81.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice81()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-81" id="product-save-price-81">
</span>
<span class="sd-price-without-discount-amount product-wod-price-81" id="product-wod-price-81">
</span>
<span class="price-label block"> </span>
<span id="product-price-81" class="sd-unit-price product-price-81">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.99</span> </span> / can </span>
<meta itemprop="price" content="4.99">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-81" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-81" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.99</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-81" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-81" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField81 !== 'function') {
function initQtyField81() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '81',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField81()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[81]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[81]" form="product_addtocart_form81" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[81] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-81', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form81" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/840/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/840/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form840">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="840">
<a href="https://snusdaddy.com/zyn-mini-dry-original-3-mg" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-840.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/o/r/original_460x460_4.png" loading="lazy" width="240" height="300" alt="ZYN Mini Dry Original 3 mg Product Label" title="ZYN Mini Dry Original 3 mg Product Label">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> ZYN <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/zyn-mini-dry-original-3-mg" :id="`slide-desc-840-${$id('slider-id')}`">
Mini Original 3 mg </a>
</div>
<div class="mg-per-pouch"> 3 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty840 !== 'function') {
function updateQtyBasedOnTierPriceQty840(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-840');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[840]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-840');
const priceWods = document.getElementsByClassName('product-wod-price-840');
const priceTotals = document.getElementsByClassName('sd-total-price-840');
const pricePerCans = document.getElementsByClassName('product-price-840');
let savePrice = 0;
let customTotalsPrice = 4.99;
var customPerItemPrice = 4.99;
if (qty >= 10) {
savePrice = qty * 0.5;
customTotalsPrice = parseFloat("4.49") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.49;
}
if (qty >= 30) {
savePrice = qty * 0.6;
customTotalsPrice = parseFloat("4.39") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.39;
}
if (qty >= 60) {
savePrice = qty * 0.7;
customTotalsPrice = parseFloat("4.29") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.29;
}
if (qty >= 100) {
savePrice = qty * 0.8;
customTotalsPrice = parseFloat("4.19") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.19;
}
// Calculate the price
const wodPrice = qty * 4.99;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.99);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.99)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-840 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-840" onclick="updateQtyBasedOnTierPriceQty840(this, 1)">
<span>1 can</span>
<span><span class="price">$4.99</span></span>
<span>(<span class="price">$4.99</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-840" onclick="updateQtyBasedOnTierPriceQty840(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="44.9" data-price-type="" class="price-wrapper "><span class="price">$44.90</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="4.49" data-price-type="" class="price-wrapper "><span class="price">$4.49</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-840" onclick="updateQtyBasedOnTierPriceQty840(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="131.7" data-price-type="" class="price-wrapper "><span class="price">$131.70</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="4.39" data-price-type="" class="price-wrapper "><span class="price">$4.39</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-840" onclick="updateQtyBasedOnTierPriceQty840(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="257.4" data-price-type="" class="price-wrapper "><span class="price">$257.40</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="4.29" data-price-type="" class="price-wrapper "><span class="price">$4.29</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-840" onclick="updateQtyBasedOnTierPriceQty840(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="419" data-price-type="" class="price-wrapper "><span class="price">$419.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="4.19" data-price-type="" class="price-wrapper "><span class="price">$4.19</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-840" onchange="updateQtyBasedOnTierPriceQty840(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice840() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.99,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "164236",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "840",
"website_price": 4.49,
"price_incl_tax": 4.49,
"price_excl_tax": 4.49
}, {
"price_id": "164800",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "840",
"website_price": 4.39,
"price_incl_tax": 4.39,
"price_excl_tax": 4.39
}, {
"price_id": "165364",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "840",
"website_price": 4.29,
"price_incl_tax": 4.29,
"price_excl_tax": 4.29
}, {
"price_id": "165928",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "840",
"website_price": 4.19,
"price_incl_tax": 4.19,
"price_excl_tax": 4.19
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-840.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-840.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice840()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-840" id="product-save-price-840">
</span>
<span class="sd-price-without-discount-amount product-wod-price-840" id="product-wod-price-840">
</span>
<span class="price-label block"> </span>
<span id="product-price-840" class="sd-unit-price product-price-840">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.99</span> </span> / can </span>
<meta itemprop="price" content="4.99">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-840" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-840" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.99</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-840" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-840" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField840 !== 'function') {
function initQtyField840() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '840',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField840()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[840]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[840]" form="product_addtocart_form840" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[840] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-840', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form840" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/649/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/649/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form649">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="649">
<a href="https://snusdaddy.com/zyn-slim-violet-licorice" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-649.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/s/l/slim_violet_licorice_nf_460x460.png" loading="lazy" width="240" height="300" alt="ZYN Slim Violet Licorice New Feel Product Label" title="ZYN Slim Violet Licorice New Feel Product Label">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> ZYN <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 3.7 </div>
<div class="sd-star-yellow"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/zyn-slim-violet-licorice" :id="`slide-desc-649-${$id('slider-id')}`">
Slim Violet Licorice Regular </a>
</div>
<div class="mg-per-pouch"> 6.3 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty649 !== 'function') {
function updateQtyBasedOnTierPriceQty649(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-649');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[649]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-649');
const priceWods = document.getElementsByClassName('product-wod-price-649');
const priceTotals = document.getElementsByClassName('sd-total-price-649');
const pricePerCans = document.getElementsByClassName('product-price-649');
let savePrice = 0;
let customTotalsPrice = 4.99;
var customPerItemPrice = 4.99;
if (qty >= 10) {
savePrice = qty * 0.5;
customTotalsPrice = parseFloat("4.49") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.49;
}
if (qty >= 30) {
savePrice = qty * 0.6;
customTotalsPrice = parseFloat("4.39") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.39;
}
if (qty >= 60) {
savePrice = qty * 0.7;
customTotalsPrice = parseFloat("4.29") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.29;
}
if (qty >= 100) {
savePrice = qty * 0.8;
customTotalsPrice = parseFloat("4.19") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.19;
}
// Calculate the price
const wodPrice = qty * 4.99;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.99);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.99)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-649 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-649" onclick="updateQtyBasedOnTierPriceQty649(this, 1)">
<span>1 can</span>
<span><span class="price">$4.99</span></span>
<span>(<span class="price">$4.99</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-649" onclick="updateQtyBasedOnTierPriceQty649(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="44.9" data-price-type="" class="price-wrapper "><span class="price">$44.90</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="4.49" data-price-type="" class="price-wrapper "><span class="price">$4.49</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-649" onclick="updateQtyBasedOnTierPriceQty649(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="131.7" data-price-type="" class="price-wrapper "><span class="price">$131.70</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="4.39" data-price-type="" class="price-wrapper "><span class="price">$4.39</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-649" onclick="updateQtyBasedOnTierPriceQty649(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="257.4" data-price-type="" class="price-wrapper "><span class="price">$257.40</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="4.29" data-price-type="" class="price-wrapper "><span class="price">$4.29</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-649" onclick="updateQtyBasedOnTierPriceQty649(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="419" data-price-type="" class="price-wrapper "><span class="price">$419.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="4.19" data-price-type="" class="price-wrapper "><span class="price">$4.19</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-649" onchange="updateQtyBasedOnTierPriceQty649(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice649() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.99,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "164274",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "649",
"website_price": 4.49,
"price_incl_tax": 4.49,
"price_excl_tax": 4.49
}, {
"price_id": "164838",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "649",
"website_price": 4.39,
"price_incl_tax": 4.39,
"price_excl_tax": 4.39
}, {
"price_id": "165402",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "649",
"website_price": 4.29,
"price_incl_tax": 4.29,
"price_excl_tax": 4.29
}, {
"price_id": "165966",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "649",
"website_price": 4.19,
"price_incl_tax": 4.19,
"price_excl_tax": 4.19
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-649.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-649.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice649()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-649" id="product-save-price-649">
</span>
<span class="sd-price-without-discount-amount product-wod-price-649" id="product-wod-price-649">
</span>
<span class="price-label block"> </span>
<span id="product-price-649" class="sd-unit-price product-price-649">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.99</span> </span> / can </span>
<meta itemprop="price" content="4.99">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-649" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-649" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.99</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-649" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-649" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField649 !== 'function') {
function initQtyField649() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '649',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField649()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[649]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[649]" form="product_addtocart_form649" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[649] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-649', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form649" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/984/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/984/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form984">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="984">
<a href="https://snusdaddy.com/zyn-slim-citrus-extra-strong" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-984.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/c/i/citrus_s4_460x460.png" loading="lazy" width="240" height="300" alt="ZYN Slim Citrus Extra Strong Product Label" title="ZYN Slim Citrus Extra Strong Product Label">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> ZYN <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/zyn-slim-citrus-extra-strong" :id="`slide-desc-984-${$id('slider-id')}`">
Slim Citrus Extra Strong </a>
</div>
<div class="mg-per-pouch"> 11 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty984 !== 'function') {
function updateQtyBasedOnTierPriceQty984(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-984');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[984]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-984');
const priceWods = document.getElementsByClassName('product-wod-price-984');
const priceTotals = document.getElementsByClassName('sd-total-price-984');
const pricePerCans = document.getElementsByClassName('product-price-984');
let savePrice = 0;
let customTotalsPrice = 4.99;
var customPerItemPrice = 4.99;
if (qty >= 10) {
savePrice = qty * 0.5;
customTotalsPrice = parseFloat("4.49") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.49;
}
if (qty >= 30) {
savePrice = qty * 0.6;
customTotalsPrice = parseFloat("4.39") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.39;
}
if (qty >= 60) {
savePrice = qty * 0.7;
customTotalsPrice = parseFloat("4.29") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.29;
}
if (qty >= 100) {
savePrice = qty * 0.8;
customTotalsPrice = parseFloat("4.19") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.19;
}
// Calculate the price
const wodPrice = qty * 4.99;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.99);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.99)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-984 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-984" onclick="updateQtyBasedOnTierPriceQty984(this, 1)">
<span>1 can</span>
<span><span class="price">$4.99</span></span>
<span>(<span class="price">$4.99</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-984" onclick="updateQtyBasedOnTierPriceQty984(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="44.9" data-price-type="" class="price-wrapper "><span class="price">$44.90</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="4.49" data-price-type="" class="price-wrapper "><span class="price">$4.49</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-984" onclick="updateQtyBasedOnTierPriceQty984(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="131.7" data-price-type="" class="price-wrapper "><span class="price">$131.70</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="4.39" data-price-type="" class="price-wrapper "><span class="price">$4.39</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-984" onclick="updateQtyBasedOnTierPriceQty984(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="257.4" data-price-type="" class="price-wrapper "><span class="price">$257.40</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="4.29" data-price-type="" class="price-wrapper "><span class="price">$4.29</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-984" onclick="updateQtyBasedOnTierPriceQty984(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="419" data-price-type="" class="price-wrapper "><span class="price">$419.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="4.19" data-price-type="" class="price-wrapper "><span class="price">$4.19</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-984" onchange="updateQtyBasedOnTierPriceQty984(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice984() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.99,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "164244",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "984",
"website_price": 4.49,
"price_incl_tax": 4.49,
"price_excl_tax": 4.49
}, {
"price_id": "164808",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "984",
"website_price": 4.39,
"price_incl_tax": 4.39,
"price_excl_tax": 4.39
}, {
"price_id": "165372",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "984",
"website_price": 4.29,
"price_incl_tax": 4.29,
"price_excl_tax": 4.29
}, {
"price_id": "165936",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "984",
"website_price": 4.19,
"price_incl_tax": 4.19,
"price_excl_tax": 4.19
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-984.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-984.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice984()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-984" id="product-save-price-984">
</span>
<span class="sd-price-without-discount-amount product-wod-price-984" id="product-wod-price-984">
</span>
<span class="price-label block"> </span>
<span id="product-price-984" class="sd-unit-price product-price-984">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.99</span> </span> / can </span>
<meta itemprop="price" content="4.99">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-984" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-984" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.99</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-984" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-984" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField984 !== 'function') {
function initQtyField984() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '984',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField984()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[984]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[984]" form="product_addtocart_form984" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[984] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-984', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form984" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/77/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/77/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form77">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="77">
<a href="https://snusdaddy.com/zyn-mini-dry-spearmint-1-5-mg" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-77.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/s/p/spearmint_460x460.png" loading="lazy" width="240" height="300" alt="ZYN Mini Dry Spearmint snus can at Snusdaddy.com" title="ZYN Mini Dry Spearmint snus can at Snusdaddy.com">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> ZYN <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 5 </div>
<div class="sd-star-green"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/zyn-mini-dry-spearmint-1-5-mg" :id="`slide-desc-77-${$id('slider-id')}`">
Mini Spearmint 1.5 mg </a>
</div>
<div class="mg-per-pouch"> 1.5 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty77 !== 'function') {
function updateQtyBasedOnTierPriceQty77(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-77');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[77]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-77');
const priceWods = document.getElementsByClassName('product-wod-price-77');
const priceTotals = document.getElementsByClassName('sd-total-price-77');
const pricePerCans = document.getElementsByClassName('product-price-77');
let savePrice = 0;
let customTotalsPrice = 4.99;
var customPerItemPrice = 4.99;
if (qty >= 10) {
savePrice = qty * 0.5;
customTotalsPrice = parseFloat("4.49") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.49;
}
if (qty >= 30) {
savePrice = qty * 0.6;
customTotalsPrice = parseFloat("4.39") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.39;
}
if (qty >= 60) {
savePrice = qty * 0.7;
customTotalsPrice = parseFloat("4.29") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.29;
}
if (qty >= 100) {
savePrice = qty * 0.8;
customTotalsPrice = parseFloat("4.19") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.19;
}
// Calculate the price
const wodPrice = qty * 4.99;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.99);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.99)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-77 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-77" onclick="updateQtyBasedOnTierPriceQty77(this, 1)">
<span>1 can</span>
<span><span class="price">$4.99</span></span>
<span>(<span class="price">$4.99</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-77" onclick="updateQtyBasedOnTierPriceQty77(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="44.9" data-price-type="" class="price-wrapper "><span class="price">$44.90</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="4.49" data-price-type="" class="price-wrapper "><span class="price">$4.49</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-77" onclick="updateQtyBasedOnTierPriceQty77(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="131.7" data-price-type="" class="price-wrapper "><span class="price">$131.70</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="4.39" data-price-type="" class="price-wrapper "><span class="price">$4.39</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-77" onclick="updateQtyBasedOnTierPriceQty77(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="257.4" data-price-type="" class="price-wrapper "><span class="price">$257.40</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="4.29" data-price-type="" class="price-wrapper "><span class="price">$4.29</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-77" onclick="updateQtyBasedOnTierPriceQty77(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="419" data-price-type="" class="price-wrapper "><span class="price">$419.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="4.19" data-price-type="" class="price-wrapper "><span class="price">$4.19</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-77" onchange="updateQtyBasedOnTierPriceQty77(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice77() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.99,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "164238",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "77",
"website_price": 4.49,
"price_incl_tax": 4.49,
"price_excl_tax": 4.49
}, {
"price_id": "164802",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "77",
"website_price": 4.39,
"price_incl_tax": 4.39,
"price_excl_tax": 4.39
}, {
"price_id": "165366",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "77",
"website_price": 4.29,
"price_incl_tax": 4.29,
"price_excl_tax": 4.29
}, {
"price_id": "165930",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "77",
"website_price": 4.19,
"price_incl_tax": 4.19,
"price_excl_tax": 4.19
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-77.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-77.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice77()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-77" id="product-save-price-77">
</span>
<span class="sd-price-without-discount-amount product-wod-price-77" id="product-wod-price-77">
</span>
<span class="price-label block"> </span>
<span id="product-price-77" class="sd-unit-price product-price-77">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.99</span> </span> / can </span>
<meta itemprop="price" content="4.99">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-77" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-77" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.99</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-77" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-77" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField77 !== 'function') {
function initQtyField77() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '77',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField77()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[77]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[77]" form="product_addtocart_form77" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[77] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-77', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form77" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/74/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/74/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form74">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="74">
<a href="https://snusdaddy.com/zyn-mini-dry-cool-mint-3-mg" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-74.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/c/o/cool_mint_460x460_1.png" loading="lazy" width="240" height="300" alt="ZYN Mini Dry Cool Mint snus can at Snusdaddy.com" title="ZYN Mini Dry Cool Mint snus can at Snusdaddy.com">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> ZYN <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 0 </div>
<div class="sd-star-gray"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/zyn-mini-dry-cool-mint-3-mg" :id="`slide-desc-74-${$id('slider-id')}`">
Mini Cool Mint 3 mg </a>
</div>
<div class="mg-per-pouch"> 3 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty74 !== 'function') {
function updateQtyBasedOnTierPriceQty74(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-74');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[74]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-74');
const priceWods = document.getElementsByClassName('product-wod-price-74');
const priceTotals = document.getElementsByClassName('sd-total-price-74');
const pricePerCans = document.getElementsByClassName('product-price-74');
let savePrice = 0;
let customTotalsPrice = 4.99;
var customPerItemPrice = 4.99;
if (qty >= 10) {
savePrice = qty * 0.5;
customTotalsPrice = parseFloat("4.49") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.49;
}
if (qty >= 30) {
savePrice = qty * 0.6;
customTotalsPrice = parseFloat("4.39") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.39;
}
if (qty >= 60) {
savePrice = qty * 0.7;
customTotalsPrice = parseFloat("4.29") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.29;
}
if (qty >= 100) {
savePrice = qty * 0.8;
customTotalsPrice = parseFloat("4.19") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.19;
}
// Calculate the price
const wodPrice = qty * 4.99;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.99);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.99)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-74 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-74" onclick="updateQtyBasedOnTierPriceQty74(this, 1)">
<span>1 can</span>
<span><span class="price">$4.99</span></span>
<span>(<span class="price">$4.99</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-74" onclick="updateQtyBasedOnTierPriceQty74(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="44.9" data-price-type="" class="price-wrapper "><span class="price">$44.90</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="4.49" data-price-type="" class="price-wrapper "><span class="price">$4.49</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-74" onclick="updateQtyBasedOnTierPriceQty74(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="131.7" data-price-type="" class="price-wrapper "><span class="price">$131.70</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="4.39" data-price-type="" class="price-wrapper "><span class="price">$4.39</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-74" onclick="updateQtyBasedOnTierPriceQty74(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="257.4" data-price-type="" class="price-wrapper "><span class="price">$257.40</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="4.29" data-price-type="" class="price-wrapper "><span class="price">$4.29</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-74" onclick="updateQtyBasedOnTierPriceQty74(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="419" data-price-type="" class="price-wrapper "><span class="price">$419.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="4.19" data-price-type="" class="price-wrapper "><span class="price">$4.19</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-74" onchange="updateQtyBasedOnTierPriceQty74(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice74() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.99,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "164229",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "74",
"website_price": 4.49,
"price_incl_tax": 4.49,
"price_excl_tax": 4.49
}, {
"price_id": "164793",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "74",
"website_price": 4.39,
"price_incl_tax": 4.39,
"price_excl_tax": 4.39
}, {
"price_id": "165357",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "74",
"website_price": 4.29,
"price_incl_tax": 4.29,
"price_excl_tax": 4.29
}, {
"price_id": "165921",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "74",
"website_price": 4.19,
"price_incl_tax": 4.19,
"price_excl_tax": 4.19
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-74.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-74.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice74()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-74" id="product-save-price-74">
</span>
<span class="sd-price-without-discount-amount product-wod-price-74" id="product-wod-price-74">
</span>
<span class="price-label block"> </span>
<span id="product-price-74" class="sd-unit-price product-price-74">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.99</span> </span> / can </span>
<meta itemprop="price" content="4.99">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-74" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-74" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.99</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-74" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-74" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField74 !== 'function') {
function initQtyField74() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '74',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField74()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[74]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[74]" form="product_addtocart_form74" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[74] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-74', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form74" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
POST https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/83/
<form method="post" action="https://snusdaddy.com/checkout/cart/add/uenc/%25uenc%25/product/83/" class="item product product-item product_addtocart_form card-interactive flex flex-col w-full " id="product_addtocart_form83">
<input name="form_key" type="hidden" value="20taJtUEzBpVetXs"> <input type="hidden" name="product" value="83">
<a href="https://snusdaddy.com/zyn-slim-lemon-spritz" class="product photo product-item-photo block mx-auto mb-3 product-image-link " tabindex="-1">
<img class="hover:shadow-sm object-contain product-image-photo" x-data="" @update-gallery-83.window="$root.src = $event.detail" src="https://snusdaddy.com/media/catalog/product/cache/ab068f1aa8f5f828eb1d36878b0e1731/l/e/lemon_spritz_nf_460x460.png" loading="lazy" width="240" height="300" alt="ZYN Slim Lemon Spritz snus can at Snusdaddy.com" title="ZYN Slim Lemon Spritz snus can at Snusdaddy.com">
</a>
<div class="product-info flex flex-col grow">
<div class="sd-product-info-small-wrapper">
<div class="manufacturer"> ZYN <div class="sd-trustpilot">
<div class="sd-stars">
<div class="sd-star-count"> 4.5 </div>
<div class="sd-star-green"></div>
</div>
</div>
</div>
<div class="mt-2 mb-1 items-center justify-center text-primary font-semibold text-lg text-center ">
<a class="product-item-link" href="https://snusdaddy.com/zyn-slim-lemon-spritz" :id="`slide-desc-83-${$id('slider-id')}`">
Slim Lemon Spritz Regular </a>
</div>
<div class="mg-per-pouch"> 5.6 mg / pouch </div>
</div>
<div class="py-4 my-2 tier-price-container">
<script type="text/javascript">
if (typeof updateQtyBasedOnTierPriceQty83 !== 'function') {
function updateQtyBasedOnTierPriceQty83(clicked, qty) {
// Uncheck all buttons
const allBoxes = document.getElementsByClassName('sd-tierpricebtn-83');
if (allBoxes) {
const boxes = clicked.parentNode.querySelectorAll('li.tierprice');
boxes.forEach(box => {
box.classList.remove('active');
});
}
// Get the elements
const qtyBoxCustom = clicked.parentNode.querySelector('li.sd-qty-select input');
const qtyBox = document.getElementsByClassName('qty[83]');
// Set the qty value
qtyBoxCustom.value = qty;
// If the qty box exists, set the value and trigger the change event
if (qtyBox) {
Array.from(qtyBox).forEach(qtyBoxing => {
qtyBoxing.value = qty;
qtyBoxing.dispatchEvent(new Event('input'));
qtyBoxing.dispatchEvent(new Event('change'));
});
}
// Get elements for custom prices (save/wod)
const priceSaves = document.getElementsByClassName('product-save-price-83');
const priceWods = document.getElementsByClassName('product-wod-price-83');
const priceTotals = document.getElementsByClassName('sd-total-price-83');
const pricePerCans = document.getElementsByClassName('product-price-83');
let savePrice = 0;
let customTotalsPrice = 4.99;
var customPerItemPrice = 4.99;
if (qty >= 10) {
savePrice = qty * 0.5;
customTotalsPrice = parseFloat("4.49") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.49;
}
if (qty >= 30) {
savePrice = qty * 0.6;
customTotalsPrice = parseFloat("4.39") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.39;
}
if (qty >= 60) {
savePrice = qty * 0.7;
customTotalsPrice = parseFloat("4.29") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.29;
}
if (qty >= 100) {
savePrice = qty * 0.8;
customTotalsPrice = parseFloat("4.19") * qty;
customTotalsPrice = customTotalsPrice.toFixed(2);
var customPerItemPrice = 4.19;
}
// Calculate the price
const wodPrice = qty * 4.99;
// Update the prices
if (priceWods) {
showWodPrice = (wodPrice > 0 && wodPrice > 4.99);
if (showWodPrice) {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = hyva.formatPrice(wodPrice);
});
} else {
Array.from(priceWods).forEach(priceWod => {
priceWod.innerHTML = '';
});
}
}
if (customPerItemPrice && pricePerCans) {
Array.from(pricePerCans).forEach(pricePerCan => {
Array.from(pricePerCan.getElementsByClassName('price')).forEach(price => {
price.innerHTML = hyva.formatPrice(customPerItemPrice);
});
});
}
//console.log(priceSaves);
if (priceSaves) {
Array.from(priceSaves).forEach(priceSave => {
if (savePrice > 0) {
var savePercent = (savePrice / (qty * 4.99)) * 100;
savePercent = Math.round(savePercent);
if (savePrice >= 100) {
whatYouSave = hyva.formatPrice(savePrice)
} else {
whatYouSave = savePercent + '%';
}
priceSave.innerHTML = 'Save: ' + whatYouSave;
} else {
priceSave.innerHTML = '';
}
});
}
if (priceTotals) {
//console.log(priceTotals);
Array.from(priceTotals).forEach(priceTotal => {
priceTotal.innerHTML = hyva.formatPrice(customTotalsPrice);
});
}
// Add the active class to the clicked box
clicked.classList.add('active');
}
}
</script>
<ul class="sdtp-83 prices-tier items mb-4">
<li class="tierprice sd-tierpricebtn-83" onclick="updateQtyBasedOnTierPriceQty83(this, 1)">
<span>1 can</span>
<span><span class="price">$4.99</span></span>
<span>(<span class="price">$4.99</span> / can)</span>
</li>
<li class="tierprice pos2 sd-tierpricebtn-83" onclick="updateQtyBasedOnTierPriceQty83(this, 10)">
<span>10 cans</span>
<span><span class="price-container price-tier_price tax weee">
<span data-price-amount="44.9" data-price-type="" class="price-wrapper "><span class="price">$44.90</span></span>
</span>
</span>
<span>(<span class="price-container price-tier_price tax weee">
<span data-price-amount="4.49" data-price-type="" class="price-wrapper "><span class="price">$4.49</span></span>
</span> / can)</span>
<span class="percent tier-%3">10%</span>
</li>
<li class="tierprice pos3 sd-tierpricebtn-83" onclick="updateQtyBasedOnTierPriceQty83(this, 30)">
<span>30 cans</span>
<span><span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="131.7" data-price-type="" class="price-wrapper "><span class="price">$131.70</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['1']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('1')" data-price-amount="4.39" data-price-type="" class="price-wrapper "><span class="price">$4.39</span></span>
</span> / can)</span>
<span class="percent tier-%3">12%</span>
</li>
<li class="tierprice pos4 sd-tierpricebtn-83" onclick="updateQtyBasedOnTierPriceQty83(this, 60)">
<span>60 cans</span>
<span><span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="257.4" data-price-type="" class="price-wrapper "><span class="price">$257.40</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['2']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('2')" data-price-amount="4.29" data-price-type="" class="price-wrapper "><span class="price">$4.29</span></span>
</span> / can)</span>
<span class="percent tier-%3">14%</span>
</li>
<li class="tierprice pos5 sd-tierpricebtn-83" onclick="updateQtyBasedOnTierPriceQty83(this, 100)">
<span>100 cans</span>
<span><span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="419" data-price-type="" class="price-wrapper "><span class="price">$419.00</span></span>
</span>
</span>
<span>(<span x-data="" x-id="['3']" class="price-container price-tier_price tax weee" x-defer="intersect" x-ignore="">
<span :id="$id('3')" data-price-amount="4.19" data-price-type="" class="price-wrapper "><span class="price">$4.19</span></span>
</span> / can)</span>
<span class="percent tier-%3">16%</span>
</li>
<li class="tierprice sd-qty-select" style="display: block;">
<input type="text" value="1" id="qty-tp-83" onchange="updateQtyBasedOnTierPriceQty83(this.parentNode, this.value)">
<span>Select amount</span>
</li>
</ul>
</div>
<div class="flex flex-col sm:flex-row items-end my-4 sd-product-info-price-add-cart">
<div role="group" aria-label="Price">
<script type="text/javascript">
function initPrice83() {
const regularPriceInclTaxKey = 'oldPrice',
regularPriceExclTaxKey = 'baseOldPrice',
finalPriceInclTaxKey = 'finalPrice',
finalPriceExclTaxKey = 'basePrice';
function calculateCustomOptionPrices(activeCustomOptions, customOptionPrices) {
return activeCustomOptions.reduce((priceAccumulator, activeCustomOptionId) => {
const customOptionPrice = customOptionPrices[activeCustomOptionId];
if (customOptionPrice) {
return Number.parseFloat(priceAccumulator) + Number.parseFloat(customOptionPrice);
}
return priceAccumulator;
}, 0);
}
return {
regularPriceKey: regularPriceInclTaxKey,
finalPriceKey: finalPriceInclTaxKey,
activeProductsPriceData: false,
initialFinalPrice: 4.99,
calculatedFinalPrice: false,
calculatedFinalPriceWithCustomOptions: false,
initialTierPrices: [{
"price_id": "164265",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 10,
"percentage_value": "10.00",
"product_id": "83",
"website_price": 4.49,
"price_incl_tax": 4.49,
"price_excl_tax": 4.49
}, {
"price_id": "164829",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 30,
"percentage_value": "12.00",
"product_id": "83",
"website_price": 4.39,
"price_incl_tax": 4.39,
"price_excl_tax": 4.39
}, {
"price_id": "165393",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 60,
"percentage_value": "14.00",
"product_id": "83",
"website_price": 4.29,
"price_incl_tax": 4.29,
"price_excl_tax": 4.29
}, {
"price_id": "165957",
"website_id": "2",
"all_groups": "1",
"cust_group": 32000,
"price": {},
"price_qty": 100,
"percentage_value": "16.00",
"product_id": "83",
"website_price": 4.19,
"price_incl_tax": 4.19,
"price_excl_tax": 4.19
}],
showRegularPriceLabel: false,
customOptionPrices: [],
activeCustomOptions: [],
qty: 1,
updateCustomOptionActive(data) {
let activeCustomOptions = this.activeCustomOptions;
const customOptionId = data.customOptionId;
if (data.active) {
if (!activeCustomOptions.includes(customOptionId)) {
activeCustomOptions.push(data.customOptionId);
}
} else {
if (customOptionId && activeCustomOptions.includes(customOptionId)) {
let index = activeCustomOptions.indexOf(customOptionId);
activeCustomOptions.splice(index, 1);
}
}
this.calculateFinalPriceWithCustomOptions()
},
updateCustomOptionPrices(prices, basePrices) {
if (prices) {
this.customOptionPrices = prices;
}
this.calculateFinalPriceWithCustomOptions();
},
calculateFinalPrice() {
const findApplicableTierPrice = (initialPrice, withTax) => {
if (this.activeProductsPriceData && this.activeProductsPriceData.tierPrices) {
const key = withTax ? 'price' : 'basePrice'
return this.activeProductsPriceData.tierPrices.reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, this.activeProductsPriceData[withTax ? finalPriceInclTaxKey : finalPriceExclTaxKey].amount);
} else {
const key = withTax ? 'price_incl_tax' : 'price_excl_tax';
return Object.values(this.initialTierPrices).reduce((acc, tierPrice) => {
if (this.qty >= tierPrice.price_qty && tierPrice[key] < acc) {
return tierPrice[key];
}
return acc;
}, initialPrice);
}
}
this.calculatedFinalPrice = findApplicableTierPrice(this.initialFinalPrice, true);
window.dispatchEvent(new CustomEvent("update-product-final-price", {
detail: this.calculatedFinalPrice
}));
},
calculatePriceLabelVisibility() {
this.showRegularPriceLabel = (this.calculatedFinalPrice === this.activeProductsPriceData[this.regularPriceKey].amount) && this.activeProductsPriceData.isMinimalPrice;
},
calculateFinalPriceWithCustomOptions() {
const finalPrice = this.calculatedFinalPrice || this.initialFinalPrice;
this.calculatedFinalPriceWithCustomOptions = finalPrice + this.getCustomOptionPrice();
},
getCustomOptionPrice() {
return calculateCustomOptionPrices(this.activeCustomOptions, this.customOptionPrices);
},
getFormattedFinalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice)
},
getFormattedFinalTotalPrice() {
return hyva.formatPrice(this.calculatedFinalPriceWithCustomOptions * this.qty || this.calculatedFinalPrice * this.qty || this.initialFinalPrice * this.qty);
},
isPriceHidden() {
const finalPrice = this.calculatedFinalPriceWithCustomOptions || this.calculatedFinalPrice || this.initialFinalPrice;
return false && finalPrice === 0;
},
eventListeners: {
['@update-prices-83.window'](event) {
this.activeProductsPriceData = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
this.calculatePriceLabelVisibility();
},
['@update-qty-83.window'](event) {
this.qty = event.detail;
this.calculateFinalPrice();
this.calculateFinalPriceWithCustomOptions();
},
['@update-custom-option-active.window'](event) {
this.updateCustomOptionActive(event.detail);
},
['@update-custom-option-prices.window'](event) {
this.updateCustomOptionPrices(event.detail);
},
}
}
}
</script>
<div x-data="initPrice83()" x-bind="eventListeners" class="price-box price-final_price" x-defer="intersect" x-ignore="">
<template x-if="!activeProductsPriceData && !isPriceHidden()">
<div class="price-container">
<div class="sd-price-per-can final-price inline-block" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span class="sd-price-save-amount product-save-price-83" id="product-save-price-83">
</span>
<span class="sd-price-without-discount-amount product-wod-price-83" id="product-wod-price-83">
</span>
<span class="price-label block"> </span>
<span id="product-price-83" class="sd-unit-price product-price-83">
<span class="price" x-html="getFormattedFinalPrice()">
<span class="price">$4.99</span> </span> / can </span>
<meta itemprop="price" content="4.99">
<meta itemprop="priceCurrency" content="USD">
</div>
<div class="sd-total-price">
<span id="product-price-83" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price sd-total-price-83" x-html="getFormattedFinalTotalPrice()">
<span class="price">$4.99</span> </span>
</span>
</div>
</div>
</template>
<template x-if="activeProductsPriceData &&
activeProductsPriceData.oldPrice &&
activeProductsPriceData[finalPriceKey].amount < activeProductsPriceData[regularPriceKey].amount
">
<div class="old-price flex mr-2">
<span id="product-price-83" class="price-wrapper title-font font-regular text-xl line-through text-gray-900">
<span class="price" x-html="hyva.formatPrice(activeProductsPriceData[regularPriceKey].amount + getCustomOptionPrice())"></span>
</span>
</div>
</template>
<template x-if="activeProductsPriceData">
<div class="final-price inline-block">
<span id="product-price-83" class="price-wrapper title-font font-medium text-2xl text-gray-900">
<span class="price" x-html="getFormattedFinalPrice()"></span>
</span>
</div>
</template>
</div>
</div>
<div class="sd-product-info-qty-button">
<div class="sd-qty-field"></div>
<script type="text/javascript">
if (typeof initQtyField83 !== 'function') {
function initQtyField83() {
function findPathParam(key) {
// get all path pairs after BASE_URL/front_name/action_path/action
const baseUrl = (BASE_URL.substring(0, 2) === '//' ? 'http:' : '') + BASE_URL;
const baseUrlParts = (new URL(baseUrl)).pathname.replace(/\/$/, '').split('/');
const pathParts = window.location.pathname.split('/').slice(baseUrlParts.length + 3);
for (let i = 0; i < pathParts.length; i += 2) {
if (pathParts[i] === key && pathParts.length > i) {
return pathParts[i + 1];
}
}
}
return {
qty: 1,
itemId: (new URLSearchParams(window.location.search)).get('id') || findPathParam('id'),
productId: '83',
onGetCartData: function onGetCartData(data, $dispatch) {
const cart = data && data.data && data.data.cart;
if (this.itemId && cart && cart.items) {
const cartItem = cart.items.find((item) => {
return item.item_id === this.itemId && item.product_id === this.productId;
});
if (cartItem && cartItem.qty) {
this.qty = cartItem.qty;
$dispatch('update-qty-' + this.productId, this.qty);
}
}
}
};
}
}
</script>
<div x-data="initQtyField83()" class="sd-qty-field" x-defer="intersect" x-ignore="">
<div class="mr-2">
<label for="qty[83]" class="sr-only"> Quantity </label>
<input name="qty" @private-content-loaded.window="onGetCartData($event.detail, $dispatch)" id="qty[83]" form="product_addtocart_form83" type="number" pattern="[0-9]{0,4}" inputmode="numeric" min="1" :value="qty"
class="qty[83] form-input px-2 py-2 w-20 text-center invalid:ring-2 invalid:ring-red-500" x-model.number="qty" @change="$dispatch('update-qty-83', qty)">
</div>
</div>
<button type="submit" form="product_addtocart_form83" title="Add to Cart" class="btn btn-primary btn-sd-addtocart">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="border-current" width="24" height="24" role="img">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path>
<title>shopping-cart</title>
</svg>
<span class="hidden sm:block md:hidden lg:block">Add to Cart </span>
</button>
</div>
</div>
</div>
</form>
<form id="ac-ag-container">
<div id="ac-ag-logo-img" style="height: 100px; margin: 20px; background-image: url("https://snusdaddy.com/media/wysiwyg/Logo_150x150_hyva.png");"></div>
<div class="ac-ag-h1" id="ac-ag-title-text">Old enough to use nicotine?</div>
<div class="ac-ag-p" id="ac-ag-body-text">Depending on your location this age varies. US buyers will require age to be verified before finishing purchase.</div>
<div id="ac-ag-type-button" style="display: block;">
<div class="ac-ag-button" id="ac-ag-accept" tabindex="0"><span id="ac-ag-accept-button-text">I'm old enough</span>
<div class="ac-ag-chevron-right"></div>
</div>
</div>
<div id="ac-ag-type-yesno">
<div class="ac-ag-button" id="ac-ag-no-button" tabindex="0"><span>No</span></div>
<div class="ac-ag-button" id="ac-ag-yes-button" tabindex="0"><span>Yes</span></div>
</div>
<div id="ac-ag-type-dob" class="">
<div class="ac-ag-p ac-ag-strong">Please enter your date of birth.</div>
<div class="ac-ag-input" id="ac-ag-input-month-selector"><select name="ac_ag_dob_month" id="ac-ag-dob-month">
<option disabled="disabled" selected="selected" value="">Month</option>
</select></div>
<div class="ac-ag-input" id="ac-ag-input-month-entry"><input name="ac_ag_dob_month_input" placeholder="MM" maxlength="2" type="text" inputmode="numeric" pattern="\d*" id="ac-ag-dob-month-input"></div>
<div class="ac-ag-input"><input name="ac_ag_dob_day" placeholder="DD" maxlength="2" type="text" inputmode="numeric" pattern="\d*" id="ac-ag-dob-day"></div>
<div class="ac-ag-input"><input name="ac_ag_dob_year" placeholder="YYYY" maxlength="4" type="text" inputmode="numeric" pattern="\d*" id="ac-ag-dob-year"></div>
</div>
<div id="ac-ag-remember"><input type="checkbox" checked="checked" id="ac-ag-remember-me"><label for="ac-ag-remember-me" id="ac-ag-remember-me-label">Remember Me</label></div>
<div id="ac-ag-learn"><a class="ac-ag-link" href="https://agechecker.net/age-verification-explained" target="_blank" rel="noopener">Age Verification FAQ</a></div>
</form>
Text Content
This website uses cookies We use cookies to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners who may combine it with other information that you’ve provided to them or that they’ve collected from your use of their services. OK JavaScript seems to be disabled in your browser. For the best experience on our site, be sure to turn on Javascript in your browser. Age is just a number, but 21 is required on this page Skip to Content WARNING: This product contains nicotine. Nicotine is an addictive chemical. * Journal * USD EUR SEK USD * Global Deutsch Español EU Global * Menu * Customer Service * Brands * Iceberg Snus * Killapods * LOOP * Pablo Snus * Siberia Snus * VELO Nicotine Pouches * XQS * ZYN * Show all brands * All Products * Nicotine Pouches * White Portion * Snus * Mini Portion * Loose Snus * Nicotine Free Pouches * Show All * Strong Pouches * Strong * Extra Strong * Super Strong * Don't Go There * Show All * Special Offers * Fresh deals * Short expiration date * Show All * Other * Candy * Accessories * Show All * Best Sellers * Newcomers * CURRENCY USD - US Dollar chevron-down EUR - Euro SEK - Swedish Krona * WEBSITE Global chevron-down Deutsch Español EU Global QUESTIONS If you need any assistance or have any questions, feel free to either contact us by email or fill in the form and we will respond as soon as we can. Lidköping, Sweden info@snusdaddy.com +46 76 - 309 79 92 * All Products Show submenu for All Products category * Nicotine Pouches * White Portion * Snus * Mini Portion * Loose Snus * Nicotine Free Pouches * Strong Pouches Show submenu for Strong Pouches category * Strong * Extra Strong * Super Strong * Don't Go There * Special Offers Show submenu for Special Offers category * Fresh deals * Short expiration date * Other Show submenu for Other category * Candy * Accessories * Best Sellers * Newcomers Sign In Create an Account Toggle minicart, Cart is empty Search Search %0 ITEMS IN CART Cart is empty Cart is empty - + Subtotal: Checkout loader Loading... Close panel Checkout using your account Email Address Password Sign In Forgot Your Password? This form is protected by reCAPTCHA - the Google Privacy Policy and Terms of Service apply. Checkout as a new customer Creating an account has many benefits: * See order and shipping status * Track order history * Check out faster Create an Account Document Secure Payments Fast Shipping Competitive Prices Excellent Service * Trending * Cherry * Snus * Mini Portions * Newcomers LOOP 0 Spicy Apple Strong 9.4 mg / pouch Out of stock Alert me when back X ZYN 0 Slim Gentle Mint Regular 6.6 mg / pouch * 1 can $4.99 ($4.99 / can) * 10 cans $44.90 ( $4.49 / can) 10% * 30 cans $131.70 ( $4.39 / can) 12% * 60 cans $257.40 ( $4.29 / can) 14% * 100 cans $419.00 ( $4.19 / can) 16% * Select amount $4.99 / can $4.99 Quantity shopping-cart Add to Cart Iceberg 0 Cola 35 mg / pouch * 1 can $4.69 ($4.69 / can) * 10 cans $42.20 ( $4.22 / can) 10% * 30 cans $123.90 ( $4.13 / can) 12% * 60 cans $241.80 ( $4.03 / can) 14% * 100 cans $394.00 ( $3.94 / can) 16% * Select amount $4.69 / can $4.69 Quantity shopping-cart Add to Cart Pablo 0 50 mg Blue Raspberry 30 mg / pouch * 1 can $4.39 ($4.39 / can) * 10 cans $39.50 ( $3.95 / can) 10% * 30 cans $115.80 ( $3.86 / can) 12% * 60 cans $226.80 ( $3.78 / can) 14% * 100 cans $369.00 ( $3.69 / can) 16% * Select amount $4.39 / can $4.39 Quantity shopping-cart Add to Cart Helwit 0 Cinnapple 6 mg / pouch * 1 can $4.59 ($4.59 / can) * 10 cans $41.30 ( $4.13 / can) 10% * 30 cans $121.20 ( $4.04 / can) 12% * 60 cans $237.00 ( $3.95 / can) 14% * 100 cans $386.00 ( $3.86 / can) 16% * Select amount $4.59 / can $4.59 Quantity shopping-cart Add to Cart GOAT 0 Tropical #12 8.4 mg / pouch * 1 can $3.00 ($3.00 / can) 30% * 10 cans $30.00 ( $3.00 / can) 30% * 30 cans $90.00 ( $3.00 / can) 30% * 60 cans $180.00 ( $3.00 / can) 30% * 100 cans $300.00 ( $3.00 / can) 30% * Select amount $4.29 $3.00 / can $3.00 Quantity shopping-cart Add to Cart VELO 0 Icy Cherry 10 mg / pouch * 1 can $5.19 ($5.19 / can) * 10 cans $46.70 ( $4.67 / can) 10% * 30 cans $137.10 ( $4.57 / can) 12% * 60 cans $267.60 ( $4.46 / can) 14% * 100 cans $436.00 ( $4.36 / can) 16% * Select amount $5.19 / can $5.19 Quantity shopping-cart Add to Cart Kelly White 0 Sparkling Strawberry Slim 4.8 mg / pouch * 1 can $4.29 ($4.29 / can) * 10 cans $38.60 ( $3.86 / can) 10% * 30 cans $113.40 ( $3.78 / can) 12% * 60 cans $221.40 ( $3.69 / can) 14% * 100 cans $360.00 ( $3.60 / can) 16% * Select amount $4.29 / can $4.29 Quantity shopping-cart Add to Cart VELO 0 Groovy Grape Mini 6 mg / pouch * 1 can $5.19 ($5.19 / can) * 10 cans $46.70 ( $4.67 / can) 10% * 30 cans $137.10 ( $4.57 / can) 12% * 60 cans $267.60 ( $4.46 / can) 14% * 100 cans $436.00 ( $4.36 / can) 16% * Select amount $5.19 / can $5.19 Quantity shopping-cart Add to Cart R4VE 5 Skittler 10 mg 5 mg / pouch Out of stock Alert me when back X XQS 0 Black Cherry Strong 8 mg / pouch * 1 can $4.69 ($4.69 / can) * 10 cans $42.20 ( $4.22 / can) 10% * 30 cans $123.90 ( $4.13 / can) 12% * 60 cans $241.80 ( $4.03 / can) 14% * 100 cans $394.00 ( $3.94 / can) 16% * Select amount $4.69 / can $4.69 Quantity shopping-cart Add to Cart Oden's 4 Cold Extreme White Dry Portion 17.6 mg / pouch * 1 can $3.49 ($3.49 / can) * 10 cans $31.40 ( $3.14 / can) 10% * 30 cans $92.10 ( $3.07 / can) 12% * 60 cans $180.00 ( $3.00 / can) 14% * 100 cans $293.00 ( $2.93 / can) 16% * Select amount $3.49 / can $3.49 Quantity shopping-cart Add to Cart ZYN 4.8 Mini Dry Black Cherry 3 mg 3 mg / pouch * 1 can $4.99 ($4.99 / can) * 10 cans $44.90 ( $4.49 / can) 10% * 30 cans $131.70 ( $4.39 / can) 12% * 60 cans $257.40 ( $4.29 / can) 14% * 100 cans $419.00 ( $4.19 / can) 16% * Select amount $4.99 / can $4.99 Quantity shopping-cart Add to Cart ZYN 4.7 Mini Dry Black Cherry 6 mg 6 mg / pouch * 1 can $4.99 ($4.99 / can) * 10 cans $44.90 ( $4.49 / can) 10% * 30 cans $131.70 ( $4.39 / can) 12% * 60 cans $257.40 ( $4.29 / can) 14% * 100 cans $419.00 ( $4.19 / can) 16% * Select amount $4.99 / can $4.99 Quantity shopping-cart Add to Cart Helwit 0 Cherry 4.5 mg / pouch * 1 can $4.59 ($4.59 / can) * 10 cans $41.30 ( $4.13 / can) 10% * 30 cans $121.20 ( $4.04 / can) 12% * 60 cans $237.00 ( $3.95 / can) 14% * 100 cans $386.00 ( $3.86 / can) 16% * Select amount $4.59 / can $4.59 Quantity shopping-cart Add to Cart Candys 0 Ice Cherry Gum 33.5 mg / pouch * 1 can $4.39 ($4.39 / can) * 10 cans $39.50 ( $3.95 / can) 10% * 30 cans $115.80 ( $3.86 / can) 12% * 60 cans $226.80 ( $3.78 / can) 14% * 100 cans $369.00 ( $3.69 / can) 16% * Select amount $4.39 / can $4.39 Quantity shopping-cart Add to Cart FEDRS 0 Tobacco Cherry Hard 32.5 mg / pouch * 1 can $5.29 ($5.29 / can) * 10 cans $47.60 ( $4.76 / can) 10% * 30 cans $139.80 ( $4.66 / can) 12% * 60 cans $273.00 ( $4.55 / can) 14% * 100 cans $444.00 ( $4.44 / can) 16% * Select amount $5.29 / can $5.29 Quantity shopping-cart Add to Cart XQS 0 Black Cherry Strong 8 mg / pouch * 1 can $4.69 ($4.69 / can) * 10 cans $42.20 ( $4.22 / can) 10% * 30 cans $123.90 ( $4.13 / can) 12% * 60 cans $241.80 ( $4.03 / can) 14% * 100 cans $394.00 ( $3.94 / can) 16% * Select amount $4.69 / can $4.69 Quantity shopping-cart Add to Cart R4VE 5 Merry Cherry 10 mg 5 mg / pouch * 1 can $4.19 ($4.19 / can) * 10 cans $37.70 ( $3.77 / can) 10% * 30 cans $110.70 ( $3.69 / can) 12% * 60 cans $216.00 ( $3.60 / can) 14% * 100 cans $352.00 ( $3.52 / can) 16% * Select amount $4.19 / can $4.19 Quantity shopping-cart Add to Cart R4VE 0 Merry Cherry 30 mg 15 mg / pouch * 1 can $4.19 ($4.19 / can) * 10 cans $37.70 ( $3.77 / can) 10% * 30 cans $110.70 ( $3.69 / can) 12% * 60 cans $216.00 ( $3.60 / can) 14% * 100 cans $352.00 ( $3.52 / can) 16% * Select amount $4.19 / can $4.19 Quantity shopping-cart Add to Cart Iceberg 0 Cherry 35 mg / pouch * 1 can $4.69 ($4.69 / can) * 10 cans $42.20 ( $4.22 / can) 10% * 30 cans $123.90 ( $4.13 / can) 12% * 60 cans $241.80 ( $4.03 / can) 14% * 100 cans $394.00 ( $3.94 / can) 16% * Select amount $4.69 / can $4.69 Quantity shopping-cart Add to Cart CUBA 0 Black Cherry 42.9 mg / pouch * 1 can $4.89 ($4.89 / can) * 10 cans $44.00 ( $4.40 / can) 10% * 30 cans $129.00 ( $4.30 / can) 12% * 60 cans $252.60 ( $4.21 / can) 14% * 100 cans $411.00 ( $4.11 / can) 16% * Select amount $4.89 / can $4.89 Quantity shopping-cart Add to Cart R4VE 0 Minty Berry 50 mg 25 mg / pouch * 1 can $4.19 ($4.19 / can) * 10 cans $37.70 ( $3.77 / can) 10% * 30 cans $110.70 ( $3.69 / can) 12% * 60 cans $216.00 ( $3.60 / can) 14% * 100 cans $352.00 ( $3.52 / can) 16% * Select amount $4.19 / can $4.19 Quantity shopping-cart Add to Cart RUSH 0 Cherry Burnout 21 mg / pouch Out of stock Alert me when back X Siberia 0 -80 White Dry Slim Portion 28 mg / pouch * 1 can $4.09 ($4.09 / can) * 10 cans $36.80 ( $3.68 / can) 10% * 30 cans $108.00 ( $3.60 / can) 12% * 60 cans $211.20 ( $3.52 / can) 14% * 100 cans $344.00 ( $3.44 / can) 16% * Select amount $4.09 / can $4.09 Quantity shopping-cart Add to Cart Röda Lacket 0 Loose 7.9 mg / pouch * 1 can $4.59 ($4.59 / can) * 10 cans $41.30 ( $4.13 / can) 10% * 30 cans $121.20 ( $4.04 / can) 12% * 60 cans $237.00 ( $3.95 / can) 14% * 100 cans $386.00 ( $3.86 / can) 16% * Select amount $4.59 / can $4.59 Quantity shopping-cart Add to Cart Lundgrens 0 Skåne Strong White Portion 15.1 mg / pouch * 1 can $2.79 ($2.79 / can) * 10 cans $25.10 ( $2.51 / can) 10% * 30 cans $73.80 ( $2.46 / can) 12% * 60 cans $144.00 ( $2.40 / can) 14% * 100 cans $234.00 ( $2.34 / can) 16% * Select amount $2.79 / can $2.79 Quantity shopping-cart Add to Cart Siberia 0 -80 White Portion 24 mg / pouch * 1 can $4.39 ($4.39 / can) * 10 cans $39.50 ( $3.95 / can) 10% * 30 cans $115.80 ( $3.86 / can) 12% * 60 cans $226.80 ( $3.78 / can) 14% * 100 cans $369.00 ( $3.69 / can) 16% * Select amount $4.39 / can $4.39 Quantity shopping-cart Add to Cart Siberia 4.6 -80 White Dry Portion 34.4 mg / pouch * 1 can $4.39 ($4.39 / can) * 10 cans $39.50 ( $3.95 / can) 10% * 30 cans $115.80 ( $3.86 / can) 12% * 60 cans $226.80 ( $3.78 / can) 14% * 100 cans $369.00 ( $3.69 / can) 16% * Select amount $4.39 / can $4.39 Quantity shopping-cart Add to Cart Oden's 4 Cold Extreme White Dry Portion 17.6 mg / pouch * 1 can $3.49 ($3.49 / can) * 10 cans $31.40 ( $3.14 / can) 10% * 30 cans $92.10 ( $3.07 / can) 12% * 60 cans $180.00 ( $3.00 / can) 14% * 100 cans $293.00 ( $2.93 / can) 16% * Select amount $3.49 / can $3.49 Quantity shopping-cart Add to Cart Nick & Johnny 0 Americana Portion Extra Strong 16.5 mg / pouch * 1 can $4.39 ($4.39 / can) * 10 cans $39.50 ( $3.95 / can) 10% * 30 cans $115.80 ( $3.86 / can) 12% * 60 cans $226.80 ( $3.78 / can) 14% * 100 cans $369.00 ( $3.69 / can) 16% * Select amount $4.39 / can $4.39 Quantity shopping-cart Add to Cart The Lab 0 06 Slim Portion Extra Strong 18 mg / pouch * 1 can $4.29 ($4.29 / can) * 10 cans $38.60 ( $3.86 / can) 10% * 30 cans $113.40 ( $3.78 / can) 12% * 60 cans $221.40 ( $3.69 / can) 14% * 100 cans $360.00 ( $3.60 / can) 16% * Select amount $4.29 / can $4.29 Quantity shopping-cart Add to Cart Göteborgs Rapé 0 Original Portion 9.5 mg / pouch * 1 can $4.19 ($4.19 / can) * 10 cans $37.70 ( $3.77 / can) 10% * 30 cans $110.70 ( $3.69 / can) 12% * 60 cans $216.00 ( $3.60 / can) 14% * 100 cans $352.00 ( $3.52 / can) 16% * Select amount $4.19 / can $4.19 Quantity shopping-cart Add to Cart General 5 Original Portion Extra Strong 15.5 mg / pouch * 1 can $4.19 ($4.19 / can) * 10 cans $37.70 ( $3.77 / can) 10% * 30 cans $110.70 ( $3.69 / can) 12% * 60 cans $216.00 ( $3.60 / can) 14% * 100 cans $352.00 ( $3.52 / can) 16% * Select amount $4.19 / can $4.19 Quantity shopping-cart Add to Cart Ettan 5 White Portion 7 mg / pouch * 1 can $4.19 ($4.19 / can) * 10 cans $37.70 ( $3.77 / can) 10% * 30 cans $110.70 ( $3.69 / can) 12% * 60 cans $216.00 ( $3.60 / can) 14% * 100 cans $352.00 ( $3.52 / can) 16% * Select amount $4.19 / can $4.19 Quantity shopping-cart Add to Cart General 5 White Portion 7 mg / pouch * 1 can $4.19 ($4.19 / can) * 10 cans $37.70 ( $3.77 / can) 10% * 30 cans $110.70 ( $3.69 / can) 12% * 60 cans $216.00 ( $3.60 / can) 14% * 100 cans $352.00 ( $3.52 / can) 16% * Select amount $4.19 / can $4.19 Quantity shopping-cart Add to Cart ZYN 0 Mini Dry Black Licorice 3 mg 3 mg / pouch * 1 can $4.99 ($4.99 / can) * 10 cans $44.90 ( $4.49 / can) 10% * 30 cans $131.70 ( $4.39 / can) 12% * 60 cans $257.40 ( $4.29 / can) 14% * 100 cans $419.00 ( $4.19 / can) 16% * Select amount $4.99 / can $4.99 Quantity shopping-cart Add to Cart Kelly White 0 Raspberry Lemon Mini 3.2 mg / pouch * 1 can $4.29 ($4.29 / can) * 10 cans $38.60 ( $3.86 / can) 10% * 30 cans $113.40 ( $3.78 / can) 12% * 60 cans $221.40 ( $3.69 / can) 14% * 100 cans $360.00 ( $3.60 / can) 16% * Select amount $4.29 / can $4.29 Quantity shopping-cart Add to Cart Kelly White 0 Hot Cherry Mini 6.5 mg / pouch * 1 can $4.29 ($4.29 / can) * 10 cans $38.60 ( $3.86 / can) 10% * 30 cans $113.40 ( $3.78 / can) 12% * 60 cans $221.40 ( $3.69 / can) 14% * 100 cans $360.00 ( $3.60 / can) 16% * Select amount $4.29 / can $4.29 Quantity shopping-cart Add to Cart VELO 0 Wintery Watermelon Mini 6 mg / pouch * 1 can $5.19 ($5.19 / can) * 10 cans $46.70 ( $4.67 / can) 10% * 30 cans $137.10 ( $4.57 / can) 12% * 60 cans $267.60 ( $4.46 / can) 14% * 100 cans $436.00 ( $4.36 / can) 16% * Select amount $5.19 / can $5.19 Quantity shopping-cart Add to Cart VELO 0 Crispy Peppermint Mini 8 mg / pouch * 1 can $5.19 ($5.19 / can) * 10 cans $46.70 ( $4.67 / can) 10% * 30 cans $137.10 ( $4.57 / can) 12% * 60 cans $267.60 ( $4.46 / can) 14% * 100 cans $436.00 ( $4.36 / can) 16% * Select amount $5.19 / can $5.19 Quantity shopping-cart Add to Cart LOOP 0 Red Chili Melon Mini 6.8 mg / pouch * 1 can $4.49 ($4.49 / can) * 10 cans $40.40 ( $4.04 / can) 10% * 30 cans $118.50 ( $3.95 / can) 12% * 60 cans $231.60 ( $3.86 / can) 14% * 100 cans $377.00 ( $3.77 / can) 16% * Select amount $4.49 / can $4.49 Quantity shopping-cart Add to Cart ZYN 4.7 Mini Dry Black Cherry 6 mg 6 mg / pouch * 1 can $4.99 ($4.99 / can) * 10 cans $44.90 ( $4.49 / can) 10% * 30 cans $131.70 ( $4.39 / can) 12% * 60 cans $257.40 ( $4.29 / can) 14% * 100 cans $419.00 ( $4.19 / can) 16% * Select amount $4.99 / can $4.99 Quantity shopping-cart Add to Cart Pablo 5 Mini Ice Cold 15 mg / pouch * 1 can $4.39 ($4.39 / can) * 10 cans $39.50 ( $3.95 / can) 10% * 30 cans $115.80 ( $3.86 / can) 12% * 60 cans $226.80 ( $3.78 / can) 14% * 100 cans $369.00 ( $3.69 / can) 16% * Select amount $4.39 / can $4.39 Quantity shopping-cart Add to Cart LOOP 5 Mint Mania Mini 3 mg / pouch * 1 can $4.49 ($4.49 / can) * 10 cans $40.40 ( $4.04 / can) 10% * 30 cans $118.50 ( $3.95 / can) 12% * 60 cans $231.60 ( $3.86 / can) 14% * 100 cans $377.00 ( $3.77 / can) 16% * Select amount $4.49 / can $4.49 Quantity shopping-cart Add to Cart ZYN 4.6 Mini Bellini 3 mg 3 mg / pouch * 1 can $4.99 ($4.99 / can) * 10 cans $44.90 ( $4.49 / can) 10% * 30 cans $131.70 ( $4.39 / can) 12% * 60 cans $257.40 ( $4.29 / can) 14% * 100 cans $419.00 ( $4.19 / can) 16% * Select amount $4.99 / can $4.99 Quantity shopping-cart Add to Cart ZYN 5 Mini Spearmint 1.5 mg 1.5 mg / pouch * 1 can $4.99 ($4.99 / can) * 10 cans $44.90 ( $4.49 / can) 10% * 30 cans $131.70 ( $4.39 / can) 12% * 60 cans $257.40 ( $4.29 / can) 14% * 100 cans $419.00 ( $4.19 / can) 16% * Select amount $4.99 / can $4.99 Quantity shopping-cart Add to Cart ZYN 0 Mini Cool Mint 3 mg 3 mg / pouch * 1 can $4.99 ($4.99 / can) * 10 cans $44.90 ( $4.49 / can) 10% * 30 cans $131.70 ( $4.39 / can) 12% * 60 cans $257.40 ( $4.29 / can) 14% * 100 cans $419.00 ( $4.19 / can) 16% * Select amount $4.99 / can $4.99 Quantity shopping-cart Add to Cart TIEL 0 Original Mint 0 mg / pouch * 1 can $4.29 ($4.29 / can) * 10 cans $38.60 ( $3.86 / can) 10% * 30 cans $113.40 ( $3.78 / can) 12% * 60 cans $221.40 ( $3.69 / can) 14% * 100 cans $360.00 ( $3.60 / can) 16% * Select amount $4.29 / can $4.29 Quantity shopping-cart Add to Cart TIEL 0 Violet Licorice 0 mg / pouch * 1 can $4.29 ($4.29 / can) * 10 cans $38.60 ( $3.86 / can) 10% * 30 cans $113.40 ( $3.78 / can) 12% * 60 cans $221.40 ( $3.69 / can) 14% * 100 cans $360.00 ( $3.60 / can) 16% * Select amount $4.29 / can $4.29 Quantity shopping-cart Add to Cart TIEL 0 Sweet Elderflower 0 mg / pouch * 1 can $4.29 ($4.29 / can) * 10 cans $38.60 ( $3.86 / can) 10% * 30 cans $113.40 ( $3.78 / can) 12% * 60 cans $221.40 ( $3.69 / can) 14% * 100 cans $360.00 ( $3.60 / can) 16% * Select amount $4.29 / can $4.29 Quantity shopping-cart Add to Cart GOAT 0 Cool Mint #28 19.6 mg / pouch * 1 can $3.00 ($3.00 / can) 30% * 10 cans $30.00 ( $3.00 / can) 30% * 30 cans $90.00 ( $3.00 / can) 30% * 60 cans $180.00 ( $3.00 / can) 30% * 100 cans $300.00 ( $3.00 / can) 30% * Select amount $4.29 $3.00 / can $3.00 Quantity shopping-cart Add to Cart ZYN 0 Mini Dry Black Licorice 3 mg 3 mg / pouch * 1 can $4.99 ($4.99 / can) * 10 cans $44.90 ( $4.49 / can) 10% * 30 cans $131.70 ( $4.39 / can) 12% * 60 cans $257.40 ( $4.29 / can) 14% * 100 cans $419.00 ( $4.19 / can) 16% * Select amount $4.99 / can $4.99 Quantity shopping-cart Add to Cart ZYN 0 Slim Red Fruit Regular 6.6 mg / pouch * 1 can $4.99 ($4.99 / can) * 10 cans $44.90 ( $4.49 / can) 10% * 30 cans $131.70 ( $4.39 / can) 12% * 60 cans $257.40 ( $4.29 / can) 14% * 100 cans $419.00 ( $4.19 / can) 16% * Select amount $4.99 / can $4.99 Quantity shopping-cart Add to Cart VELO 0 Frosty Lemon 10 mg / pouch * 1 can $5.19 ($5.19 / can) * 10 cans $46.70 ( $4.67 / can) 10% * 30 cans $137.10 ( $4.57 / can) 12% * 60 cans $267.60 ( $4.46 / can) 14% * 100 cans $436.00 ( $4.36 / can) 16% * Select amount $5.19 / can $5.19 Quantity shopping-cart Add to Cart VELO 0 Wintery Watermelon 10 mg / pouch * 1 can $5.19 ($5.19 / can) * 10 cans $46.70 ( $4.67 / can) 10% * 30 cans $137.10 ( $4.57 / can) 12% * 60 cans $267.60 ( $4.46 / can) 14% * 100 cans $436.00 ( $4.36 / can) 16% * Select amount $5.19 / can $5.19 Quantity shopping-cart Add to Cart VELO 0 Rich Elaichi 10 mg / pouch * 1 can $5.19 ($5.19 / can) * 10 cans $46.70 ( $4.67 / can) 10% * 30 cans $137.10 ( $4.57 / can) 12% * 60 cans $267.60 ( $4.46 / can) 14% * 100 cans $436.00 ( $4.36 / can) 16% * Select amount $5.19 / can $5.19 Quantity shopping-cart Add to Cart VELO 0 Blushy Strawberry Mini 6 mg / pouch Out of stock Alert me when back X ZYN 4.7 Mini Dry Black Cherry 6 mg 6 mg / pouch * 1 can $4.99 ($4.99 / can) * 10 cans $44.90 ( $4.49 / can) 10% * 30 cans $131.70 ( $4.39 / can) 12% * 60 cans $257.40 ( $4.29 / can) 14% * 100 cans $419.00 ( $4.19 / can) 16% * Select amount $4.99 / can $4.99 Quantity shopping-cart Add to Cart ZYN 4.6 Mini Bellini 3 mg 3 mg / pouch * 1 can $4.99 ($4.99 / can) * 10 cans $44.90 ( $4.49 / can) 10% * 30 cans $131.70 ( $4.39 / can) 12% * 60 cans $257.40 ( $4.29 / can) 14% * 100 cans $419.00 ( $4.19 / can) 16% * Select amount $4.99 / can $4.99 Quantity shopping-cart Add to Cart ZYN 5 Mini Citrus 3 mg 3 mg / pouch * 1 can $4.99 ($4.99 / can) * 10 cans $44.90 ( $4.49 / can) 10% * 30 cans $131.70 ( $4.39 / can) 12% * 60 cans $257.40 ( $4.29 / can) 14% * 100 cans $419.00 ( $4.19 / can) 16% * Select amount $4.99 / can $4.99 Quantity shopping-cart Add to Cart ZYN 5 Mini Espressino 3 mg 3 mg / pouch * 1 can $4.99 ($4.99 / can) * 10 cans $44.90 ( $4.49 / can) 10% * 30 cans $131.70 ( $4.39 / can) 12% * 60 cans $257.40 ( $4.29 / can) 14% * 100 cans $419.00 ( $4.19 / can) 16% * Select amount $4.99 / can $4.99 Quantity shopping-cart Add to Cart ZYN 0 Mini Fresh Mint 3.5 mg / pouch * 1 can $4.99 ($4.99 / can) * 10 cans $44.90 ( $4.49 / can) 10% * 30 cans $131.70 ( $4.39 / can) 12% * 60 cans $257.40 ( $4.29 / can) 14% * 100 cans $419.00 ( $4.19 / can) 16% * Select amount $4.99 / can $4.99 Quantity shopping-cart Add to Cart ZYN 4.5 Mini Cool Mint 6 mg 6 mg / pouch * 1 can $4.99 ($4.99 / can) * 10 cans $44.90 ( $4.49 / can) 10% * 30 cans $131.70 ( $4.39 / can) 12% * 60 cans $257.40 ( $4.29 / can) 14% * 100 cans $419.00 ( $4.19 / can) 16% * Select amount $4.99 / can $4.99 Quantity shopping-cart Add to Cart ZYN 0 Mini Original 3 mg 3 mg / pouch * 1 can $4.99 ($4.99 / can) * 10 cans $44.90 ( $4.49 / can) 10% * 30 cans $131.70 ( $4.39 / can) 12% * 60 cans $257.40 ( $4.29 / can) 14% * 100 cans $419.00 ( $4.19 / can) 16% * Select amount $4.99 / can $4.99 Quantity shopping-cart Add to Cart ZYN 3.7 Slim Violet Licorice Regular 6.3 mg / pouch * 1 can $4.99 ($4.99 / can) * 10 cans $44.90 ( $4.49 / can) 10% * 30 cans $131.70 ( $4.39 / can) 12% * 60 cans $257.40 ( $4.29 / can) 14% * 100 cans $419.00 ( $4.19 / can) 16% * Select amount $4.99 / can $4.99 Quantity shopping-cart Add to Cart ZYN 0 Slim Citrus Extra Strong 11 mg / pouch * 1 can $4.99 ($4.99 / can) * 10 cans $44.90 ( $4.49 / can) 10% * 30 cans $131.70 ( $4.39 / can) 12% * 60 cans $257.40 ( $4.29 / can) 14% * 100 cans $419.00 ( $4.19 / can) 16% * Select amount $4.99 / can $4.99 Quantity shopping-cart Add to Cart ZYN 5 Mini Spearmint 1.5 mg 1.5 mg / pouch * 1 can $4.99 ($4.99 / can) * 10 cans $44.90 ( $4.49 / can) 10% * 30 cans $131.70 ( $4.39 / can) 12% * 60 cans $257.40 ( $4.29 / can) 14% * 100 cans $419.00 ( $4.19 / can) 16% * Select amount $4.99 / can $4.99 Quantity shopping-cart Add to Cart ZYN 0 Mini Cool Mint 3 mg 3 mg / pouch * 1 can $4.99 ($4.99 / can) * 10 cans $44.90 ( $4.49 / can) 10% * 30 cans $131.70 ( $4.39 / can) 12% * 60 cans $257.40 ( $4.29 / can) 14% * 100 cans $419.00 ( $4.19 / can) 16% * Select amount $4.99 / can $4.99 Quantity shopping-cart Add to Cart ZYN 4.5 Slim Lemon Spritz Regular 5.6 mg / pouch * 1 can $4.99 ($4.99 / can) * 10 cans $44.90 ( $4.49 / can) 10% * 30 cans $131.70 ( $4.39 / can) 12% * 60 cans $257.40 ( $4.29 / can) 14% * 100 cans $419.00 ( $4.19 / can) 16% * Select amount $4.99 / can $4.99 Quantity shopping-cart Add to Cart Featured Blog Posts Best ZYNs for Beginners: Ranked By Strength & Popularity Read more 8 months ago Edited 3 months ago On! Vs ZYN Nicotine Pouches: Flavors, Strengths & Ingredients On! Vs ZYN Nicotine Pouches: Flavors, Strengths & Ingredients Read more 7 months ago Edited 4 months ago How Many mg of Nicotine Are in ZYN Nicotine Pouches? Read more 6 months ago Edited 3 months ago How Much Nicotine Do You Absorb from Nicotine Pouches? Read more 6 months ago Edited 3 months ago Can ZYN Nicotine Pouches Cause Anxiety? The Facts & Solutions Read more 6 months ago Edited 3 months ago List of New ZYN Flavors 2024 & How To Buy Them Read more 5 months ago Edited 3 months ago chevron-left chevron-right chevron-left chevron-right Swedish Snus of the highest quality is what you get when you buy snus online from us at Snusdaddy. We offer fast deliveries worldwide, we deliver Swedish snus to virtually any country, such as the USA, Switzerland, United Arab Emirates to name a few. Order snus online via Snusdaddy and you will find a giant selection of snus and nicotine pouches. You will find everything from VELO nicotine pouches and the best ZYN flavors to the bestseller LYFT Freeze and the more classic General snus flavors. WE HAVE ALL THE BRANDS YOU WANT FROM NICOTINE POUCHES & SNUS On our website, you will find snus varieties from well-known manufacturers such as: General, LOOP, Shiro, VOLT, White Fox, ZYN, Catch, Ettan, Göteborgs Rapé, Grov, Habit Factory, Scandinavian Tobacco Group, Jakobsson's, Kaliber, Kapten, Kickup, Klint, Knekt, Knox, Kronan, Kurbits, Lundgrens, LYFT, Nordic Snus, Nordic Spirit, Odens, One, R42, Siberia, Skruf, Swave, The Lab, VID, Xrange and more at extremely competitive prices. QUICK DELIVERY OF QUALITY SWEDISH SNUS & NICOTINE POUCHES ONLINE Order snus online and get fast deliveries straight home to your address with UPS or Postnord. Our focus is that you, as a customer, who buy snus online at Snusdaddy get the best snus prices, a smooth shopping experience and fast deliveries of products of the highest quality. The tobacco pouches are sent safely with UPS or Postnord so that you can easily track your delivery. Snusddaddy's main goal is satisfied customers who are offered to buy snus of the best quality at a low price. You will find several hundred Swedish snus varieties of our webshop, and we offer a wide range of both tobacco and tobacco-free snus so that everyone can find their favorite product. You will find everything from classic tobacco flavours, fresh mint snus flavors and exciting news in our range. We are experts in snus and snus sales, so do not hesitate to contact our customer service at info@snusdaddy.com if you have any questions regarding our variety of chews. We only offer Swedish snus of the highest quality when you buy snus online at cheap prices with us. We buy our snus from well-established suppliers such as GN Tobacco, Swedish Match, Skruf and many more. Our goal is to offer the market's lowest prices on snus. At Snusdaddy you will find most things in snus. We are big snus enthusiasts ourselves and have tested most things that can be tested regarding snus. Our combined experience has gathered a wide range of quality snus that we offer at low prices and always with fast and safe delivery via UPS. We aim to always send our orders within 24 hours, and we deliver to large parts of the world within 2-3 working days. Cheap shipping is important as well at Snusdaddy. As shipping is a significant cost when it comes to ordering snus online, we strive to have the market's lowest shipping costs. This means that the total cost of your Swedish snus will be significantly lower. MOST POPULAR SNUS VARIATIONS ON SNUSDADDY Siberia: Siberia snus is GN Tobacco's flagship product. An immensely popular snus that is categorized as very strong. Siberia is one of the world's strongest snus with a nicotine content of 43 mg/g in the White Dry version. If you like strong snus, Siberia snus is a clear candidate at the very top. Siberia Red, which has a clear mint taste, provides an incredibly intense snus experience. The most intense you can find when it comes to Swedish snus. General: The General snus flavors are classic with pure flavors of tobacco and bergamot as well as notes of tea, hay, and leather. Swedish snus is ingenious in its simplicity. If you use your General snus locator to find your General White snus, you can stop looking. Snusdaddy.com has the market's best prices on Swedish snus, so order snus online with us at Snusdaddy. We have an entire range of General snus flavors. Nick & Johnny: Swedish Snus from Nick & Johnny is strong, tasty and manufactured by Swedish Match. The brand is relatively new on the market and was first launched in Norway, where it quickly became popular. Nick & Johnny comes as a Original Portion and White Portion. Its products and flavours include Crushed Ice, Red Hot and Americano. Buy snus online from Snusdaddy to get the market's lowest prices on Swedish snus. Thunder snus: Incredibly popular Thunder snus from V2 tobacco has become a big seller on the snus market in the USA. Strong snus that has healthy flavors of mint. Mint snus together with a high nicotine content provides an intense snus experience. Thunder snus is a hidden gem for many, but has, as I said, broken through and become incredibly popular in the American snus market. Great taste and high nicotine content at a fantastic price. Thunder snus is very affordable and Swedish snus that should get more attention. Order snus online! Best price for Thunder snus! Order snus USA! Kronan: Today there is a wide variety of snus, which comes in different tastes and shapes. Kronan snus stands for something else – traditional snus with a dark and clear tobacco character. Kronan is not an old brand in the Swedish Match family, however, the foundation of the recipe has been clearly influenced by the Swedish Match tradition. The result is a snus that reminds us of how snus has always tasted. Kronan is a classic snus – in all its simplicity. A Wide Variety Of Flavors If you order snus online, there are some nicotine pouches you shouldn't miss out on. VELO: Are you looking for a maxed-out nicotine experience? Then LYFT is the Nicopod you are looking for. With intense and qualitative flavors, there are Swedish snus and Swedish nicotine pouches that you must not miss. LYFT Nicotine Pouches in 2022 changed its name to VELO. This means that you will then find your favorite LYFT Freeze under the name VELO Freeze. When it comes to Snus London, it's VELO Freeze that counts. With us at Snusdaddy, we send LYFT nicotine pouches and Swedish snus worldwide when you buy snus online. Nicopods at low prices and an exciting selection are what you will find when you buy snus online from us. If LYFT Freeze is not for you, you can check out our entire range of nicopods and find just your best LYFT flavors or the best VELO flavors. ZYN: The market's largest brand when it comes to nicotine pouches. ZYN nicotine pouches come in a variety of flavors and in this post, I am going to go through these different ZYN flavors. To begin with, ZYN is available in three different variants. ZYN mini, ZYN slim and ZYN mini extra strong. All variants are discreet and lie comfortably under the lip. ZYN mini is the smallest pouch that also comes in a mini package. The format fits perfectly in your inner pocket or in a purse. ZYN slim is a normal-sized pouch with the difference that it is narrower and longer than a traditional pouch. This makes it more discreet and flows less, which is well suited when you do not want to display your nicotine intake. Personally, I think that ZYN slim is the perfect choice when you meet customers at work or if you are at a dinner with your mother-in-law. LOOP: LOOP nicotine pouches are white, soft nicotine pouches without any tobacco. They provide a quick nicotine kick through the Instant RushTM technology and guarantee a controlled and long-lasting nicotine experience. LOOP nicopods is available in different strengths depending on what your needs are and in addition, you can choose from many fresh and unique flavors that last a long time and leave a very pleasant aftertaste. Killapods: NGP Empire, which is behind the bestseller Killa nicotine pouches, has managed to combine exciting seasonings, high nicotine content and comfortable nicopods. Killa nicotine pouches have become a success in Europe. Countries like France, Spain, the Netherlands, and Belgium are completely screaming for Killapods. Killa Cold Mint is the star in the Killapods family, and if you have not tried Killapods, it's time. Killapods Netherlands! Killapods Belgium! Pablo Snus: Strong nicotine pouches for you who are used to high nicotine intake. Pablo Ice Cold is something out of the ordinary. Pablo snus is 100% tobacco-free and has a nicotine content of 30 mg/g, which can almost be compared with the extremely strong Siberia snus. DIFFERENT TYPES OF PORTION SNUS Original Portion: The demand for packaged portions arose in the 70s, which led to the original portion being produced. The original portions are moist on the surface and dark. It gives a quick taste and a strong nicotine experience. It is usually called ordinary portion snus White Portion: Launched in the late '90s, also called white portion snus. Unlike the original portion, it is not moisturized and is thus less runny. It gives a slower and smoother taste and nicotine experience than the original portion. Nicotine Pouches: Nicopods is a snus that does not contain any tobacco, but only nicotine. The portions are completely dry and make it take a few seconds before you enjoy the nicotine and taste experience. Nicotine pouches are a relatively new phenomenon and have completely exploded in use. Nicotine pouches are available in plenty of flavors. As All White snus does not contain any tobacco, it is not covered by the EU ban on snus. Snusdaddy, therefore, distributes All White to the entire EU. Some examples of countries that use All White a lot are Germany, Austria, Spain, Belgium, France, and the Netherlands. DIFFERENT SIZES OF PORTION SNUS Large: Still the most common size of portion snus. The large prill is very popular and fills richly under the lip. It distributes the taste and nicotine in an efficient and tasteful way. Slim: Slim is a narrower portion that many prefer due to a long-lasting taste and generally lesser flow compared to the large. Super slim: A newer variant of the portion snus that is narrower than slim which makes it even more discreet. The nicotine and taste experience is equivalent to the slim size of snus. Mini: Mini is a small portion that lies discreetly under the lip for a neutral look. The taste and nicotine experience are mild and pleasant. Snusdaddy has the best price on ZYN online. If you are going to buy snus online, we are your obvious choice. Order snus online and choose between the best ZYN flavours or the General snus flavours. You don't need your General snus locator, Snusdaddy is open 24/7 and ready to pack your snus when you order snus online. Swedish snus such as General snus and VELO nicotine pouches can always be found with us at Snusdaddy. Siberia snus is always in stock and you do not have to search for ZYN near me as Snusdaddy is always a push of a button away. Buy VOLT nicotine pouches and much more when you want Swedish snus at the market's lowest price. Buy snus USA and we deliver within 2-4 working days. Pablo snus! Killapods! Swedish snus online! As mentioned before. If you need any clarification, concerns or suggestions, feel free to contact us at info@snusdaddy.com or any other social platform. GOOD THINGS TO KNOW ABOUT SNUS AND SNUSDADDY Who's Snusdaddy? Snusdaddy is a fictional character who reflects the founders' great passion in life, snus and nicotine pouches. Snusdaddy aims to offer Swedish snus and nicotine pouches worldwide. Where are you located? We are located in Sweden, the home and motherland of snus and nicotine pouches! What is snus and nicotine pouches? Both products (except loose snus) are pouches that you place under the lip to enjoy the flavor of the contents and effects of the nicotine they contain. The main difference between snus and nicotine pouches is that snus (categorized as Snus (Original Portion), White Portion and Loose) contains tobacco while nicotine pouches are 100% tobacco free. How do I use it? Pick up a pouch from the can and place it under your lip, top lip is recommended. Once in the mouth, you can leave it there up to 60 minutes, depending how long the pouch lasts and your personal preference. Do you ship your products to my country? If you are uncertain if we ship to your country, try to add some products to your cart and go to the checkout. If you receive an error message once the initial information is filled, we can't help you, but if you don't, we can offer our services. Make sure to read the answer to the question below as well before proceeding. What import rules and customs regulations apply to my country? Regarding import rules and customs regulations for your country, we must ask you to review what applies yourself, as we can not help with this at Snusdaddy. You as the buyer are responsible for finding out information regarding import rules and customs regulations for snus. Any fees such as customs fees and taxes must be paid by the recipient in your own country and even here you as the customer have your own responsibility. Snusdaddy disclaims all responsibility for any reimbursement or sending of replacement goods if the goods have been seized at customs. When is my order being shipped? Either the same day or next business day, depending on what time the order was made. This may differ for Postnord where processing may take slightly longer from time to time. In Sweden, Saturdays and Sundays are not business days and we do have some national holidays to have a lookout for as well where our shipping suppliers simply don't pick goods up and we can't have them shipped. As an example, if your order was made on Friday after a certain time of day, your order will be shipped on Monday after the weekend and there is nothing we can do about it. Placing an order Follow the steps to place an order: Find the items you want to buy, chose how many pieces you like, and press Add to Cart. The items will move to the cart at the top of the right side. In your cart you will find an overview of all the items you have added. You can change quantity with the + and – symbols. When you are pleased with your selection, click on Proceed to Checkout and complete your order. Once in the checkout, fill in the necessary information to receive the shipping options. Choose the one that fits best and proceed to fill in the rest of your shipping information. When this is done, you will be presented with our payment options where you need only press the Apple Pay button or fill in your card information and then proceed to accept the terms and press buy. You may need to verify the payment and all banks have different ways to do so. Shop Brands All Products Strong Pouches Special Offers Other Best Sellers Newcomers Shop Brands All Products Strong Pouches Special Offers Other Best Sellers Newcomers Help FAQ Privacy and Cookie Policy Terms & Conditions About Us Contact Snusdaddy Journal Help FAQ Privacy and Cookie Policy Terms & Conditions About Us Contact Snusdaddy Journal info@snusdaddy.com +46 76 309 79 92 © 2024 Invicta Sweden AB 8bc3e39a8ad6e8178597dd903059a8460612d3a82d81854c95c377f874a192f1 31.187.78.169 Old enough to use nicotine? Depending on your location this age varies. US buyers will require age to be verified before finishing purchase. I'm old enough No Yes Please enter your date of birth. Month Remember Me Age Verification FAQ AgeChecker.Net