function on_keydown_remove_from_cart(e){" "===e.key&&(e.preventDefault(),e.currentTarget.click())}function focus_populate_live_region(){var e=["woocommerce-message","woocommerce-error","wc-block-components-notice-banner"].map(function(e){return"."+e+'[role="alert"]'}).join(", "),o=document.querySelectorAll(e);if(0!==o.length){var t=o[0];t.setAttribute("tabindex","-1");var n=setTimeout(function(){t.focus(),clearTimeout(n)},500)}}function refresh_sorted_by_live_region(){var e=document.querySelector(".woocommerce-result-count");if(e){var o=e.innerHTML;e.setAttribute("aria-hidden","true");var t=setTimeout(function(){e.setAttribute("aria-hidden","false"),e.innerHTML="",e.innerHTML=o,clearTimeout(t)},2e3)}}function on_document_ready(){focus_populate_live_region(),refresh_sorted_by_live_region()}jQuery(function(e){e(".woocommerce-ordering").on("change","select.orderby",function(){e(this).closest("form").trigger("submit")}),e("input.qty:not(.product-quantity input.qty)").each(function(){var o=parseFloat(e(this).attr("min"));o>=0&&parseFloat(e(this).val())<o&&e(this).val(o)});var o="store_notice"+(e(".woocommerce-store-notice").data("noticeId")||"");if("hidden"===Cookies.get(o))e(".woocommerce-store-notice").hide();else{function t(o){["Enter"," "].includes(o.key)&&(o.preventDefault(),e(".woocommerce-store-notice__dismiss-link").click())}e(".woocommerce-store-notice").show(),e(".woocommerce-store-notice__dismiss-link").on("click",function n(r){Cookies.set(o,"hidden",{path:"/"}),e(".woocommerce-store-notice").hide(),r.preventDefault(),e(".woocommerce-store-notice__dismiss-link").off("click",n).off("keydown",t)}).on("keydown",t)}e(".woocommerce-input-wrapper span.description").length&&e(document.body).on("click",function(){e(".woocommerce-input-wrapper span.description:visible").prop("aria-hidden",!0).slideUp(250)}),e(".woocommerce-input-wrapper").on("click",function(e){e.stopPropagation()}),e(".woocommerce-input-wrapper :input").on("keydown",function(o){var t=e(this).parent().find("span.description");if(27===o.which&&t.length&&t.is(":visible"))return t.prop("aria-hidden",!0).slideUp(250),o.preventDefault(),!1}).on("click focus",function(){var o=e(this).parent(),t=o.find("span.description");o.addClass("currentTarget"),e(".woocommerce-input-wrapper:not(.currentTarget) span.description:visible").prop("aria-hidden",!0).slideUp(250),t.length&&t.is(":hidden")&&t.prop("aria-hidden",!1).slideDown(250),o.removeClass("currentTarget")}),e.scroll_to_notices=function(o){o.length&&e("html, body").animate({scrollTop:o.offset().top-100},1e3)},e('.woocommerce form .woocommerce-Input[type="password"]').wrap('<span class="password-input"></span>'),e(".woocommerce form input").filter(":password").parent("span").addClass("password-input"),e(".password-input").each(function(){const o=e(this).find("input").attr("id");e(this).append('<button type="button" class="show-password-input" aria-label="'+woocommerce_params.i18n_password_show+'" aria-describedBy="'+o+'"></button>')}),e(".show-password-input").on("click",function(o){o.preventDefault(),e(this).hasClass("display-password")?(e(this).removeClass("display-password"),e(this).attr("aria-label",woocommerce_params.i18n_password_show)):(e(this).addClass("display-password"),e(this).attr("aria-label",woocommerce_params.i18n_password_hide)),e(this).hasClass("display-password")?e(this).siblings(['input[type="password"]']).prop("type","text"):e(this).siblings('input[type="text"]').prop("type","password"),e(this).siblings("input").focus()}),e("a.coming-soon-footer-banner-dismiss").on("click",function(o){var t=e(o.target);e.ajax({type:"post",url:t.data("rest-url"),data:{woocommerce_meta:{coming_soon_banner_dismissed:"yes"}},beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",t.data("rest-nonce"))},complete:function(){e("#coming-soon-footer-banner").hide()}})}),"undefined"==typeof wc_add_to_cart_params&&e(document.body).on("keydown",".remove_from_cart_button",on_keydown_remove_from_cart),e(document.body).on("item_removed_from_classic_cart updated_wc_div",focus_populate_live_region)}),document.addEventListener("DOMContentLoaded",on_document_ready);
;(function($){
let options=wcLiquid.options||{},
currentPage=wcLiquid.paged||1,
loaderHtml='<span class="row-bg-loader"></span>',
ajaxFilter=options.wcAjaxFilter||'off',
ajaxPagination=options.wcAjaxPagination||'off',
paginationType=options.wcAjaxPaginationType||'classic',
paginationButtonText=options.wcAjaxPaginationButtonText||'Load more products',
whatClicked='filter',
scrollTracking=true;
$(document).ready(ready);
function ready(){
let priceFilterWidget=$('.widget_price_filter'),
productCategoriesWidget=$('.widget_product_categories, .wc-block-product-categories'),
productVariantSwatchesWidget=$('.liquid_woo_variation_swatches_widget'),
layeredNavWidget=$('.widget_layered_nav').not('[class*=yith-woo-ajax-]'),
wcNoticesWrapper=$('.woocommerce-notices-wrapper'),
ldShopTopbar=$('.ld-shop-topbar'),
ulProducts=$('ul.products'),
wcPagination=$('.woocommerce-pagination'),
$wcAjaxBtn=null;
$('span.count').each(function (){
$(this).text($(this).text().replace(/[()]/g, '') );
});
if(isOn(ajaxPagination)&&ulProducts.length&&wcPagination.length){
ajaxPaginationInit();
}
if(isOn(ajaxFilter)&&ulProducts.length){
ajaxFilterInit();
}
let urlParams=new URLSearchParams(window.location.search);
if((urlParams.get('min_price')||urlParams.get('max_price')||~window.location.search.indexOf('filter_') ) &&
(isOn(ajaxFilter)||isOn(ajaxPagination) )
){
updateProducts();
}
function updateProducts(){
let filters={},
url=new URL(location.href),
selectOrderBy=$('select.orderby'),
orderBy=selectOrderBy.val()||'menu_order',
s=urlParams.get('s')||'',
chosenFilters=[];
if(priceFilterWidget.length){
let minPrice=priceFilterWidget.find('#min_price'),
maxPrice=priceFilterWidget.find('#max_price');
if(parseInt(minPrice.val())!==parseInt(minPrice.data('min') ) ||
parseInt(maxPrice.val())!==parseInt(maxPrice.data('max') )){
filters[ 'min_price' ]=parseInt(minPrice.val());
filters[ 'max_price' ]=parseInt(maxPrice.val());
}}
if(layeredNavWidget.length){
$.each(layeredNavWidget.find('.chosen .count'), function(key, chosen){
let value=filters[ $(chosen).data('filter') ] ? filters[ $(chosen).data('filter') ] + ',':'';
filters[ $(chosen).data('filter') ]=value + $(chosen).data('slug');
});
}
$.each(filters, function(filterKey, filterValue){
url.searchParams.set(filterKey, filterValue);
});
url.searchParams.set('orderby', orderBy);
if(whatClicked==='filter'){
url.pathname=url.pathname.replace('page/' + currentPage, '');
currentPage=1;
}
if(whatClicked==='pagination'){
let currentPagination=$('span.page-numbers.current'),
oldPage=currentPagination.length ? parseInt(currentPagination.text()):1;
url.pathname=url.pathname.replace('page/' + oldPage, '') + 'page/' + currentPage;
}
if(productCategoriesWidget.length&&$('.woocommerce .widget_product_categories li.chosen a input, .woocommerce .wp-block-woocommerce-product-categories li.chosen a input').length){
const chosenCats=$('.woocommerce .widget_product_categories li.chosen, .woocommerce .wp-block-woocommerce-product-categories li.chosen').get();
const catsIds=chosenCats.map(cat=> cat.querySelector('input').getAttribute('data-term-id') );
filters[ 'term_id' ]=catsIds;
}else if(wcLiquid.termId){
filters[ 'term_id' ]=wcLiquid.termId;
}
if(productVariantSwatchesWidget.length&&$('.lqd-wc-swatch.lqd-selected').length){
let variants={};
const chosenTerms=$('.lqd-wc-swatch.lqd-selected').get();
chosenTerms.forEach(term=> {
const input=term.querySelector('input');
const taxonomy=input.getAttribute('data-taxonomy');
const termId=input.getAttribute('data-term-id');
if(taxonomy&&termId){
if(!variants[taxonomy]){
variants[taxonomy]=[];
}
variants[taxonomy].push(Number(termId));
}});
filters['variants']=variants;
}
$.ajax({
type: "post",
url: wcLiquid.ajaxUrl,
data: {
action: "liquid_wc_filter_ajax",
filters: filters,
page: currentPage,
orderby: orderBy,
s: s,
},
beforeSend: function (){
if('classic'===paginationType||whatClicked==='filter'){
ulProducts.addClass('items-loading').append(loaderHtml);
}
if(whatClicked==='pagination'&&'scroll'===paginationType){
$wcAjaxBtn.addClass('lqd-ajax-btn-loading');
}
if(whatClicked==='pagination'&&'button'===paginationType){
$wcAjaxBtn.addClass('lqd-ajax-btn-loading');
}},
success: function(response){
if(response.success===true){
let wcNoticesWrapperHtml=$(response.data.html).find('.woocommerce-notices-wrapper').html()||'',
ldShopTopbarHtml=$(response.data.html).find('.ld-shop-topbar').html()||'',
ulProductsHtml=$(response.data.html).find('ul.products').html()||'',
wcPaginationHtml=$(response.data.html).find('.woocommerce-pagination').html()||'';
if('classic'===paginationType||'filter'===whatClicked){
wcNoticesWrapper.html(wcNoticesWrapperHtml);
ulProducts.removeClass('items-loading').html(ulProductsHtml);
wcPagination.html(wcPaginationHtml);
$('.woocommerce-ordering').on('change', 'select.orderby', function (){
$(this).closest('form').submit();
});
$('form').liquidFormInputs();
$('html, body').animate({
scrollTop:(ulProducts?.offset()?.top||0) - $('.main-header[data-sticky-header]').outerHeight() - 130
})
}
if('pagination'===whatClicked&&('button'===paginationType||'scroll'===paginationType) ){
ulProducts.removeClass('items-loading').html(ulProducts.html() + ulProductsHtml);
wcPagination.removeClass('lqd-ajax-btn-loading');
wcPagination.html(wcPaginationHtml);
}
if(history.pushState){
}
updatePaginationLinks();
if('button'===paginationType){
changeClassicPaginationToButton();
}
if('scroll'===paginationType){
scrollTracking=true;
changeClassicPaginationToScroll();
}
$('.row-bg-loader').remove();
}}
});
}
function updatePaginationLinks(){
$('a.page-numbers').each(function (){
let pathName=location.pathname.replace('/page/' + currentPage, '') + $(this).attr('href');
$(this).attr('href', location.origin + pathName + location.search);
});
}
function changeClassicPaginationToButton(){
$('.next.page-numbers', wcPagination)
.html(`<span>${ paginationButtonText }</span>`)
.parent().addClass('wc-pagination-button');
$wcAjaxBtn=$('.wc-pagination-button a', wcPagination);
wcPagination
.addClass('wc-pagination-type-button')
.find('li:not(.wc-pagination-button)').hide();
}
function changeClassicPaginationToScroll(){
wcPagination
.addClass('wc-pagination-type-scroll')
.find('li').hide();
}
function ajaxPaginationInit(){
if('scroll'===paginationType){
$(window).on('scroll', function (){
let scrollHeight=$(this).scrollTop() + window.innerHeight,
ulProductsBottom=ulProducts.offset().top + ulProducts.height();
if(scrollTracking&&scrollHeight >=ulProductsBottom){
scrollTracking=false;
$('.next.page-numbers').trigger('click');
}});
changeClassicPaginationToScroll();
}
if(['button', 'scroll'].includes(paginationType)){
changeClassicPaginationToButton();
}
$(document).on('click', 'a.page-numbers', function(e){
e.preventDefault();
let currentPagination=$('span.page-numbers.current');
currentPage=currentPagination.length ? parseInt(currentPagination.text()):1
if($(this).hasClass('next') ){
currentPage++;
}
if($(this).hasClass('prev') ){
currentPage--;
}
if($.isNumeric($(this).text()) ){
currentPage=parseInt($(this).text());
}
whatClicked='pagination';
updateProducts();
});
}
function ajaxFilterInit(){
if(priceFilterWidget.length){
priceFilterWidget.find('form').on('submit', function(e){
e.preventDefault();
whatClicked='filter';
updateProducts();
});
}
$(document).on('submit', 'form.woocommerce-ordering', function(e){
e.preventDefault();
whatClicked='filter';
updateProducts();
});
if(productCategoriesWidget.length){
productCategoriesWidget.find('a').on('click', function(e){
e.preventDefault();
$(this).parent().toggleClass('chosen');
whatClicked='filter';
updateProducts();
});
}
if(productVariantSwatchesWidget.length){
productVariantSwatchesWidget.find('.lqd-wc-swatch').on('click', function(e){
e.preventDefault();
$(this).toggleClass('lqd-selected');
whatClicked='filter';
updateProducts();
});
}
if(layeredNavWidget.length){
layeredNavWidget.find('a').on('click', function(e){
e.preventDefault();
$('a[href="' + $(this).attr('href') + '"]').parent().toggleClass('woocommerce-widget-layered-nav-list__item--chosen chosen');
whatClicked='filter';
updateProducts();
});
}}
}
function isOn(option){
return option==='on';
}})(jQuery);
(($)=> {
const $quickCart=$("div.header-quickcart");
$(document).on("click", ".ld-cart-product-price-qty-update", function (e){
e.preventDefault();
const element=$(this);
const qtyWrapper=element.closest(".ld-cart-product-price-qty");
const cartItemKey=qtyWrapper.attr("data-cart-item-key");
const type=element.attr("data-cart-action");
const productsWrapper=element.closest(".ld-cart-products");
let data={
action: "liquid_update_qty",
cartItemKey: cartItemKey,
type: type,
};
$.ajax({
url: liquid_product_qty_object.ajax_url,
type: "POST",
dataType: "json",
data,
beforeSend: function (){
productsWrapper.block({
message: null,
overlayCSS: {
background: "#fff",
opacity: 0.6,
},
});
},
success: function (results){
productsWrapper.unblock();
$quickCart.empty().append(results.data.html);
$(".header-cart-fragments").html($(".item-count", $quickCart).first().html()
);
},
});
});
})(jQuery);