jQuery(document).ready((function(t){t("body").on("submit","form.cart",(function(a){const r=t(this).parents(".type-product");if(r&&r.is(".product-type-external, .product-type-grouped, .product-type-composite"))return;a.preventDefault();const e=t(this),o=e.find(".single_add_to_cart_button");let d=e.serialize();d+="&action=flatsome_ajax_add_to_cart",o.val()&&(d+="&add-to-cart="+o.val()),o.addClass("loading"),t(document.body).trigger("adding_to_cart",[o,d]),t.ajax({url:window.flatsomeVars.ajaxurl,data:d,method:"POST",success:function(a){if(!a)return;const{product_url:r,notices:e,fragments:d,cart_hash:c,error:n=""}=a;if("undefined"==typeof wc_add_to_cart_params||"yes"!==wc_add_to_cart_params.cart_redirect_after_add)if(n&&r)window.location=r;else{if(o.removeClass("loading"),e.indexOf("error")>0)return jQuery.fn.magnificPopup&&jQuery.magnificPopup.close(),void t(".woocommerce-notices-wrapper").append(e);t(document.body).trigger("added_to_cart",[d,c,o])}else window.location=wc_add_to_cart_params.cart_url}})}))}));