Home page
{
const activeParams = [...activeFilters];
if (activeSort.value) {
activeParams.push({
key: 'sort_by',
value: activeSort.value,
});
}
if (activePage > 1) {
activeParams.push({
key: 'page',
value: activePage,
});
}
const filteredSortedUrl = `${window.location.pathname}${activeParams.length > 0 ? `?${activeParams.map(v => `${v.key}=${v.value}`).join('&')}` : ''}`;
const productGridDiv = '.product-grid-items';
const productGrid = $el.querySelector(productGridDiv);
$store.ajaxWorking = true;
fetch(filteredSortedUrl)
.then((response) => response.text())
.then((responseText) => {
const html = new DOMParser().parseFromString(responseText, 'text/html');
// Update items
const productGridUpdated = html.querySelector(productGridDiv);
productGrid.innerHTML = productGridUpdated.innerHTML;
$store.ajaxWorking = false;
history.pushState({}, '', filteredSortedUrl);
// Scroll to top.
const scrollTop =
document.querySelector('.product-grid-items').getBoundingClientRect().top +
window.scrollY -
document.querySelector('.site-header').getBoundingClientRect().height - 40;
window.scrollTo({ top: scrollTop, behavior: 'smooth' });
})
.catch((e) => {
console.error(e);
$store.ajaxWorking = false;
});
}"
@paginate="
activePage = $event.detail;
$dispatch('update');
"
@sort="
activeSort = $event.detail;
$dispatch('update');
"
@filter="
$dispatch('update');
">
Cherry
See details
Best of Both Worlds Pack
Can’t decide which flavor to try? Why not have them all!
See details
3 Pack Original Flavors
See details
Blazzberry
See details
Tropical Rainbow
See details
Berry Blue
See details
The Top Seller Trio
See details
The Ultimate Zesty 16-Pack
See details
Strawnana
See details
Summer Berry
See details
Zesty Snackz Hat (Munch)
See details
Mango
See details
Cherry
See details
Best of Both Worlds Pack
Can’t decide which flavor to try? Why not have them all!
See details
3 Pack Original Flavors
See details
Blazzberry
See details
Tropical Rainbow
See details
Berry Blue
See details
The Top Seller Trio
See details
The Ultimate Zesty 16-Pack
See details
Strawnana
See details
Summer Berry
See details
Zesty Snackz Hat (Munch)
See details
Mango
See details