{});
}
window.dispatchEvent(new CustomEvent('show-toast', { detail: { message: 'Wishlist deleted.' } }));
},
removeItem(groupId, productId) {
const ev = this.events.find(e => String(e.id) === String(groupId));
if (ev && ev.items) {
const item = ev.items.find(i => String(i.id) === String(productId) || (i.productId && String(i.productId) === String(productId)));
const pid = item ? (item.productId || item.id) : productId;
ev.items = ev.items.filter(i => String(i.id) !== String(productId) && (!i.productId || String(i.productId) !== String(productId)));
this.saveWishlists();
const csrfToken = document.querySelector('meta[name="csrf-token"]')?.getAttribute('content');
fetch('/api/user/wishlist/item', {
method: 'DELETE',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
...(csrfToken ? { 'X-CSRF-TOKEN': csrfToken } : {})
},
body: JSON.stringify({
product_id: pid,
collection_name: ev ? ev.name : undefined
})
}).catch(() => {});
window.dispatchEvent(new CustomEvent('show-toast', { detail: { message: 'Item removed from wishlist.' } }));
}
},
moveToCart(item) {
if (window.Alpine && Alpine.store('cart')) {
Alpine.store('cart').addItem({
id: item.id,
title: item.title,
price: item.price,
image: item.image,
category: item.category,
inStock: true
});
window.dispatchEvent(new CustomEvent('show-toast', { detail: { message: 'Added \'' + item.title + '\' to cart!' } }));
}
},
moveAllToCart(group) {
if (!group || !group.items || group.items.length === 0) return;
if (window.Alpine && Alpine.store('cart')) {
group.items.forEach(item => {
Alpine.store('cart').addItem({
id: item.id,
title: item.title,
price: item.price,
image: item.image,
category: item.category,
inStock: true
});
});
window.dispatchEvent(new CustomEvent('show-toast', { detail: { message: 'All items added to cart!' } }));
}
},
copyShareLink(group) {
if (navigator.clipboard) {
navigator.clipboard.writeText(window.location.href);
}
window.dispatchEvent(new CustomEvent('show-toast', { detail: { message: 'Wishlist link copied to clipboard!' } }));
}
}"
>
My Wishlist
Organize and shop your saved products in custom collections.
Items Saved
Your wishlist is currently empty
Explore our catalog and save your favorite electronics to your personal collections.
Explore CatalogNo items saved in this collection yet.
+ Add items from catalogCreate New Collection
Group your saved products into organized collections for quick shopping.