Limpador de escovas de cabelo amigo do ambiente
Rated 4.9 out of 5 stars
203 Reviews
variant.price){
onSale = true;
}else{
onSale = false;
}
}"
@set-onetime-price.window="if($event.detail.id == 6987606032565) {
if(!$event.detail.subscribe){
variant.price = $event.detail.new_price;
variant.original_price = $event.detail.new_original_price;
}
}"
@set-subscription-price.window="if($event.detail.id == 6987606032565) {
if($event.detail.subscribe){
variant.price = $event.detail.new_price;
variant.original_price = $event.detail.new_original_price;
}
}"
@discounted-price.window="if($event.detail.id == 6987606032565) {
variant.price = $event.detail.new_price;
variant.original_price = $event.detail.new_original_price;
}"
@variant-updated.window="variant.price = $event.detail.variant.price; if(!isBundle){ soldOut = !$event.detail.availibility }"
@discount-applied.window="$nextTick(() => checkDiscountCode())"
@discount-removed.window="$nextTick(() => checkDiscountCode())"
class="price text-xl justify-center lg:justify-between font-semibold flex gap-x-2 items-center price--show-badge ">
Preço unitário
por
styles:
{
discount_percentage = $event.detail?.percentage || 0;
})"
x-init="$watch('selected', value => {
if (value.length != total_items) {
discount_percentage = 0;
}else{
discount_percentage = 0;
}
const cookieDiscount = Unick.getCookie('discount_code');
if(cookieDiscount){
const discount = discount_table.find((item) => {
return item.toLowerCase().includes(cookieDiscount.toLowerCase());
});
const discountValue = discount?.split(':')[1] || 0;
discount_percentage += parseInt(discountValue);
}
})"
x-data="{
discount_table: 'SECRETSALE:25,FB20:20,MADISON20:20,SHAWN26:26,SPRING20:20,Kitsch26:26,SPRING20:20,BFCM30:30,Abi25:25,Cat25:25,Ashley26:26,Summer20:20'.split(','),
renderPrice(price){
let total = price;
if(this.discount_percentage > 0){
total = price - (price * (this.discount_percentage / 100));
}
return Unick.formatMoney(total);
},
selected: [],
fixed_product: false,
discount_percentage: 0,
total_items: 3,
imgSrc(src, width) {
if (!src) return '';
if (/[?&]width=/.test(src)) return src.replace(/([?&]width=)\d+/, '$1' + width);
return src + (src.includes('?') ? '&' : '?') + 'width=' + width;
},
getSrcset(src) {
if (!src) return '';
return [72, 100, 144, 200].map(w => this.imgSrc(src, w) + ' ' + w + 'w').join(', ');
},
add(item) {
this.selected.push(item)
},
remove(id) {
this.selected = this.selected.filter(item => item.id !== id)
},
isInBundle(id) {
return this.selected.some(item => item.id === id)
},
priceBeforeDiscount(){
let total = 0;
this.selected.forEach(function (item) {
total += item.price;
})
return total;
},
totalPrice(){
let total = 0;
this.selected.forEach(function (item) {
total += item.price;
})
total = total - (total * (this.discount_percentage / 100));
let extraDiscount = 0;
let discount = 0;
this.selected.forEach(function (item) {
item.tags.forEach(function (tag) {
if(tag.includes('discount:') || tag.includes('Discount:') || tag.includes('discount: ') || tag.includes('Discount: ')){
discount = tag.split(':')[1];
}
})
})
if(discount > 0){
extraDiscount = total * (discount / 100);
}
return total - extraDiscount;
},
addToCart(){
let cartObj = [];
let bundleTitle = `Limpador de escovas de cabelo amigo do ambiente`;
let bundleHandle = `eco-friendly-hair-brush-cleaner`;
let bundleCount = 3;
let bundleQty = 1;
let index = 0;
// Update button text to 'adding...'
this.$refs.addToCartButton.textContent = 'Adding...';
this.selected.forEach(function (item) {
cartObj.push({
quantity: 1,
id: item.variants[0].id,
properties: {
'_fbt_bundle': bundleTitle,
'_fbt_bundle_handle': bundleHandle,
'_fbt_bundle_count': bundleCount,
}
})
})
if(this.fixed_product && this.total_items == this.selected.length){
cartObj = [];
cartObj.push({
quantity: 1,
id: this.fixed_product,
})
}
fetch(routes.cart_add_url + '.js', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
items: cartObj
})
})
.then(response => {
// Update button text back to 'add to cart'
this.$refs.addToCartButton.textContent = 'Add to cart';
// Update cart with event dispatch
this.$dispatch('update-cart', { cart: response });
// Open cart after adding product
this.$dispatch('toggle-cart-drawer');
});
}
}">
+
Frequently Bought Together
Total price:
Limpador de escovas de cabelo amigo do ambiente
346,00 Kč
Soft Violet Detangling Flexi Brush
432,00 Kč
Mala de viagem de beleza sem frascos
346,00 Kč
{
discount_percentage = $event.detail?.percentage || 0;
})"
x-init="$watch('selected', value => {
if (value.length != total_items) {
discount_percentage = 0;
}else{
discount_percentage = 0;
}
const cookieDiscount = Unick.getCookie('discount_code');
if(cookieDiscount){
const discount = discount_table.find((item) => {
return item.toLowerCase().includes(cookieDiscount.toLowerCase());
});
const discountValue = discount?.split(':')[1] || 0;
discount_percentage += parseInt(discountValue);
}
})"
x-data="{
discount_table: 'SECRETSALE:25,FB20:20,MADISON20:20,SHAWN26:26,SPRING20:20,Kitsch26:26,SPRING20:20,BFCM30:30,Abi25:25,Cat25:25,Ashley26:26,Summer20:20'.split(','),
renderPrice(price){
let total = price;
if(this.discount_percentage > 0){
total = price - (price * (this.discount_percentage / 100));
}
return Unick.formatMoney(total);
},
selected: [],
fixed_product: false,
discount_percentage: 0,
total_items: 3,
imgSrc(src, width) {
if (!src) return '';
if (/[?&]width=/.test(src)) return src.replace(/([?&]width=)\d+/, '$1' + width);
return src + (src.includes('?') ? '&' : '?') + 'width=' + width;
},
getSrcset(src) {
if (!src) return '';
return [72, 100, 144, 200].map(w => this.imgSrc(src, w) + ' ' + w + 'w').join(', ');
},
add(item) {
this.selected.push(item)
},
remove(id) {
this.selected = this.selected.filter(item => item.id !== id)
},
isInBundle(id) {
return this.selected.some(item => item.id === id)
},
priceBeforeDiscount(){
let total = 0;
this.selected.forEach(function (item) {
total += item.price;
})
return total;
},
totalPrice(){
let total = 0;
this.selected.forEach(function (item) {
total += item.price;
})
total = total - (total * (this.discount_percentage / 100));
let extraDiscount = 0;
let discount = 0;
this.selected.forEach(function (item) {
item.tags.forEach(function (tag) {
if(tag.includes('discount:') || tag.includes('Discount:') || tag.includes('discount: ') || tag.includes('Discount: ')){
discount = tag.split(':')[1];
}
})
})
if(discount > 0){
extraDiscount = total * (discount / 100);
}
return total - extraDiscount;
},
addToCart(){
let cartObj = [];
let bundleTitle = `Limpador de escovas de cabelo amigo do ambiente`;
let bundleHandle = `eco-friendly-hair-brush-cleaner`;
let bundleCount = 3;
let bundleQty = 1;
let index = 0;
this.$refs.addToCartButton.textContent = 'Adding...';
this.selected.forEach(function (item) {
cartObj.push({
quantity: 1,
id: item.variants[0].id,
properties: {
'_fbt_bundle': bundleTitle,
'_fbt_bundle_handle': bundleHandle,
'_fbt_bundle_count': bundleCount,
}
})
})
if(this.fixed_product && this.total_items == this.selected.length){
cartObj = [];
cartObj.push({
quantity: 1,
id: this.fixed_product,
})
}
fetch(routes.cart_add_url + '.js', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
items: cartObj
})
})
.then(response => {
this.$refs.addToCartButton.textContent = 'Add selected to cart';
this.$dispatch('update-cart', { cart: response });
this.$dispatch('toggle-cart-drawer');
});
}
}">
Frequently Bought Together
Limpador de escovas de cabelo amigo do ambiente
346,00 Kč
Soft Violet Detangling Flexi Brush
432,00 Kč
Mala de viagem de beleza sem frascos
346,00 Kč
Total Price:
{
discount_percentage = $event.detail?.percentage || 0;
})"
x-data="{
block_id: '01KQ0Y9KY8BAMRH2V5CCW46KE6',
loading: true,
error: false,
products: [],
selected: [],
fixed_product: false,
discount_percentage: 0,
base_discount_percentage: 0,
total_items: 0,
discount_table: 'SECRETSALE:25,FB20:20,MADISON20:20,SHAWN26:26,SPRING20:20,Kitsch26:26,SPRING20:20,BFCM30:30,Abi25:25,Cat25:25,Ashley26:26,Summer20:20'.split(','),
normalize(p) {
const variant = p.first_or_matched_variant || {};
const priceCents = Math.round(parseFloat(variant.price || 0) * 100);
const fmSrc = p.featured_media?.src || ((p.images && p.images[0]) ? p.images[0].src : '');
return {
id: p.id,
title: p.title,
handle: p.handle,
featured_image: fmSrc,
price: priceCents,
tags: p.tags || [],
variants: [{ id: variant.id }]
};
},
async fetchLayers() {
try {
const configEl = document.getElementById('layers-config');
if (!configEl) { throw new Error('Layers pixel config not found on page'); }
const config = JSON.parse(configEl.textContent);
const storefrontToken = config.storefrontApiToken || config.storefrontAccessToken;
const res = await fetch(
`https://app.uselayers.com/api/storefront/v1/blocks/${this.block_id}/products`,
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-Storefront-Access-Token': storefrontToken
},
body: JSON.stringify({
anchor_id: `6987606032565`,
anchor_handle: `eco-friendly-hair-brush-cleaner`,
pagination: { page: 1, limit: 4 },
attributes: ['id','title','handle','featured_media','images','available','vendor','tags','first_or_matched_variant']
})
}
);
const data = await res.json().catch(() => ({}));
if (!res.ok || data.error) {
throw new Error('Layers API error (' + res.status + '): ' + (data.error || 'Unknown') + ' — blockId=' + this.block_id);
}
this.products = (data.results || []).filter(p => p.available !== false);
this.total_items = this.products.length;
this.selected = this.products.map(p => this.normalize(p));
this.loading = false;
this.applyDiscountFromCookie();
} catch (e) {
console.error('[Layers] Bundle-together fetch failed:', e);
this.error = true;
this.loading = false;
}
},
applyDiscountFromCookie() {
const cookieDiscount = (typeof Unick !== 'undefined' && Unick.getCookie) ? Unick.getCookie('discount_code') : null;
if (cookieDiscount) {
const discount = this.discount_table.find((item) =>
item.toLowerCase().includes(cookieDiscount.toLowerCase())
);
const discountValue = (discount && discount.split(':')[1]) || 0;
this.discount_percentage = this.base_discount_percentage + parseInt(discountValue);
}
},
renderPrice(price) {
let total = price;
if (this.discount_percentage > 0) {
total = price - (price * (this.discount_percentage / 100));
}
return Unick.formatMoney(total);
},
imgSrc(src, width) {
if (!src) return '';
if (/[?&]width=/.test(src)) return src.replace(/([?&]width=)\d+/, '$1' + width);
return src + (src.includes('?') ? '&' : '?') + 'width=' + width;
},
getSrcset(src) {
if (!src) return '';
return [72, 100, 144, 200].map(w => this.imgSrc(src, w) + ' ' + w + 'w').join(', ');
},
add(item) { this.selected.push(item); },
remove(id) { this.selected = this.selected.filter(item => item.id !== id); },
isInBundle(id) { return this.selected.some(item => item.id === id); },
priceBeforeDiscount() {
return this.selected.reduce((t, item) => t + item.price, 0);
},
totalPrice() {
let total = this.selected.reduce((t, item) => t + item.price, 0);
if (this.selected.length !== this.total_items) {
return total;
}
total = total - (total * (this.discount_percentage / 100));
let extraDiscount = 0;
let discount = 0;
this.selected.forEach((item) => {
(item.tags || []).forEach((tag) => {
if (tag.includes('discount:') || tag.includes('Discount:')) {
discount = tag.split(':')[1];
}
});
});
if (discount > 0) {
extraDiscount = total * (discount / 100);
}
return total - extraDiscount;
},
addToCart() {
let cartObj = [];
const bundleTitle = `Limpador de escovas de cabelo amigo do ambiente`;
const bundleHandle = `eco-friendly-hair-brush-cleaner`;
const bundleCount = this.products.length;
this.$refs.addToCartButton.textContent = 'Adding...';
this.selected.forEach((item) => {
cartObj.push({
quantity: 1,
id: item.variants[0].id,
properties: {
'_fbt_bundle': bundleTitle,
'_fbt_bundle_handle': bundleHandle,
'_fbt_bundle_count': bundleCount,
}
});
});
if (this.fixed_product && this.total_items === this.selected.length) {
cartObj = [{ quantity: 1, id: this.fixed_product }];
}
fetch(routes.cart_add_url + '.js', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ items: cartObj })
}).then((response) => {
this.$refs.addToCartButton.textContent = `Add selected to cart`;
this.$dispatch('update-cart', { cart: response });
this.$dispatch('toggle-cart-drawer');
});
}
}"
x-init="$nextTick(() => {
$watch('selected', (value) => {
if (value.length !== total_items) {
discount_percentage = 0;
} else {
discount_percentage = base_discount_percentage;
applyDiscountFromCookie();
}
});
fetchLayers();
})"
x-show="!loading && products.length > 0">
+
Frequently Bought Together
Total price:
{
let mainAddToCart = document.querySelector('.product__info-wrapper .button-add-to-cart, .product__info-wrapper .product-form__submit');
if(mainAddToCart) {
let rect = mainAddToCart.getBoundingClientRect();
// Hide floating cart when main button is visible (with some buffer)
show = rect.top > window.innerHeight || rect.bottom < 0;
} else {
// If main button not found, show floating cart
show = true;
}
})"
x-init="$nextTick(() => {
// Delay initialization to ensure Alpine has rendered the main add-to-cart button
setTimeout(() => {
let mainAddToCart = document.querySelector('.product__info-wrapper .button-add-to-cart, .product__info-wrapper .product-form__submit');
if(mainAddToCart) {
let rect = mainAddToCart.getBoundingClientRect();
show = rect.top > window.innerHeight || rect.bottom < 0;
} else {
// Fallback: show sticky cart if main button not found after delay
show = true;
}
}, 500);
})"
class="add-to-cart-footer p-3 bg-white text-black fixed bottom-0 w-full z-20 shadow border-t">
{
selectOptions[$event.detail?.position] = $event.detail?.event?.target.value;
let getVariant = Unick.findVariant(variants , selectOptions);
selectedVariant = (getVariant) ? getVariant : null;
})">
Limpador de escovas de cabelo amigo do ambiente
variant.price){
onSale = true;
}else{
onSale = false;
}
}"
@set-onetime-price.window="if($event.detail.id == 6987606032565) {
if(!$event.detail.subscribe){
variant.price = $event.detail.new_price;
variant.original_price = $event.detail.new_original_price;
}
}"
@set-subscription-price.window="if($event.detail.id == 6987606032565) {
if($event.detail.subscribe){
variant.price = $event.detail.new_price;
variant.original_price = $event.detail.new_original_price;
}
}"
@discounted-price.window="if($event.detail.id == 6987606032565) {
variant.price = $event.detail.new_price;
variant.original_price = $event.detail.new_original_price;
}"
@variant-updated.window="variant.price = $event.detail.variant.price; if(!isBundle){ soldOut = !$event.detail.availibility }"
@discount-applied.window="$nextTick(() => checkDiscountCode())"
@discount-removed.window="$nextTick(() => checkDiscountCode())"
class="price flex gap-x-2 items-center">
Preço unitário
por
{
qty = $event.detail.qty;
})"
x-init="$nextTick(() => {
$watch('qty', value => {
console.log('qty', value);
$dispatch('quantity-updated', { qty: value });
});
});"
@quantity-updated.window="$nextTick(() => {
qty = $event.detail.qty;
})"
x-data="{ qty: 1 }">