EQBB110EQBB110 BIG BLU POWER HAMMER 110 LBS.
');
jQuery.post(ajaxurl+"?action=check_qty_beforeadd_callback", jQuery('#AddToCartForm').serialize(), function(response) {
if(response != ""){
jQuery(".mainPopupCart").remove();
jQuery("body").append(response);
}
jQuery("#myLoader").remove();
});
return false;*/
}
/*var checkqty = $('.checkqty').val()
var qty = $('.qty').val();
if(qty > checkqty){
var html = '
“Sorry we do not have enough in stock to full fill your order
';
$(".custom-msg").remove();
$(".product ").before(html);
return false;
}*/
var form = $(this);
form.block({ message: null, overlayCSS: { background: '#fff', opacity: 0.6 } });
var formData = new FormData(form[0]);
formData.append('add-to-cart', form.find('[name=add-to-cart]').val() );
var product_id = form.find('[name=add-to-cart]').val();
var callonce =true;
if(moreqty){
qty = qty - available;
formData.set('quantity',available);
}
// Ajax action.
$.ajax({
url: wc_add_to_cart_params.wc_ajax_url.toString().replace( '%%endpoint%%', 'ace_add_to_cart' ),
data: formData,
type: 'POST',
processData: false,
contentType: false,
complete: function( response ) {
response = response.responseJSON;
if ( ! response ) {
return;
}
if ( response.error && response.product_url ) {
window.location = response.product_url;
return;
}
// Redirect to cart option
if ( wc_add_to_cart_params.cart_redirect_after_add === 'yes' ) {
window.location = wc_add_to_cart_params.cart_url;
return;
}
var $thisbutton = form.find('.single_add_to_cart_button'); //
// var $thisbutton = null; // uncomment this if you don't want the 'View cart' button
// Trigger event so themes can refresh other areas.
$( document.body ).trigger( 'added_to_cart', [ response.fragments, response.cart_hash, $thisbutton ] );
// Remove existing notices
$( '.woocommerce-error, .woocommerce-message, .woocommerce-info' ).remove();
// Add new notices
form.closest('.product').before(response.fragments.notices_html);
var mainPopupCartResponse = "";
$(document).ajaxStop(function() {
if(callonce){
jQuery.post(wc_add_to_cart_params.wc_ajax_url.toString().replace( '%%endpoint%%', 'getvariants' ),{'product_id':product_id}, function(response) {
if(response != ""){
jQuery(".allvariants").html('');
jQuery(".allvariants").html(response);
callonce = false;
var soldOut = true;
jQuery("form#AddToCartForm input:radio[name='warehouse']").each(function(){
var available = parseInt(jQuery(this).data('available'));
if(available > 0){
soldOut = false;
}
});
if (soldOut) {
jQuery(".mainPopupCart").remove();
var html = '
Sorry we do not have enough in stock to full fill your order
';
$(".custom-msg").remove();
$(".product").before(html);
$("form#AddToCartForm .quantity").remove();
$("form#AddToCartForm .single_add_to_cart_button").remove();
} else {
jQuery(".mainPopupCart").remove();
jQuery("body").append(mainPopupCartResponse);
}
jQuery(".blockUI").remove();
}
});
}
});
if(moreqty){
jQuery("body").append('
');
jQuery.post(ajaxurl+"?action=check_qty_beforeadd_callback", jQuery('#AddToCartForm').serialize(), function(response) {
if(response != ""){
mainPopupCartResponse = response;
}
});
return false;
}
form.unblock();
}
});
});
jQuery(document).on("submit","#cartFormPopup",function(e) {
e.preventDefault();
var available = parseInt(jQuery(this).find('input:radio[name=warehouse]:checked').data('available'));
var qty = parseInt(jQuery(this).find('input[name=quantity]').val());
var moreqtypop = false;
if(qty > available){
moreqtypop = true;
}
var form = $(this);
form.block({ message: null, overlayCSS: { background: '#fff', opacity: 0.6 } });
var formData = new FormData(form[0]);
formData.append('add-to-cart', form.find('[name=add-to-cart]').val() );
var product_id = form.find('[name=add-to-cart]').val();
var callonce = true;
if(moreqtypop){
qty = qty - available;
formData.set('quantity', available);
}
// Ajax action.
$.ajax({
url: wc_add_to_cart_params.wc_ajax_url.toString().replace( '%%endpoint%%', 'ace_add_to_cart' ),
data: formData,
type: 'POST',
processData: false,
contentType: false,
complete: function( response ) {
response = response.responseJSON;
if ( ! response ) {
return;
}
if ( response.error && response.product_url ) {
window.location = response.product_url;
return;
}
// Redirect to cart option
if ( wc_add_to_cart_params.cart_redirect_after_add === 'yes' ) {
window.location = wc_add_to_cart_params.cart_url;
return;
}
var $thisbutton = form.find('.single_add_to_cart_button'); //
// var $thisbutton = null; // uncomment this if you don't want the 'View cart' button
// Trigger event so themes can refresh other areas.
$( document.body ).trigger( 'added_to_cart', [ response.fragments, response.cart_hash, $thisbutton ] );
// Remove existing notices
$( '.woocommerce-error, .woocommerce-message, .woocommerce-info' ).remove();
// Add new notices
form.closest('.product').before(response.fragments.notices_html);
var mainPopupCartResponse = "";
$(document).ajaxStop(function() {
if(callonce){
jQuery.post(wc_add_to_cart_params.wc_ajax_url.toString().replace( '%%endpoint%%', 'getvariants' ),{'product_id':product_id}, function(response) {
if(response != ""){
jQuery(".allvariants").html('');
jQuery(".allvariants").html(response);
callonce =false;
var soldOut = true;
jQuery("form#AddToCartForm input:radio[name='warehouse']").each(function(){
var available = parseInt(jQuery(this).data('available'));
if(available > 0){
soldOut = false;
}
});
if (soldOut) {
jQuery(".mainPopupCart").remove();
var html = '
Sorry we do not have enough in stock to full fill your order
';
$(".custom-msg").remove();
$(".product").before(html);
$("form#AddToCartForm .quantity").remove();
$("form#AddToCartForm .single_add_to_cart_button").remove();
} else {
jQuery(".mainPopupCart").remove();
jQuery("body").append(mainPopupCartResponse);
}
jQuery(".blockUI").remove();
}
});
}
});
if(moreqtypop){
jQuery("body").append('
');
jQuery.post(ajaxurl+"?action=check_qty_beforeadd_callback", jQuery('#cartFormPopup').serialize(), function(response) {
if(response != ""){
mainPopupCartResponse = response;
}
});
return false;
}
form.unblock();
}
});
});
if (jQuery('.mainPopupCart').length) {
var html = jQuery('.mainPopupCart').html();
if(html !== ""){
html = '
' + html + '
';
jQuery("body").append(html);
if (jQuery('#festi-cart-pop-up-content').length) {
jQuery('#festi-cart-pop-up-content').hide();
jQuery('.woocommerce-message').hide();
}
}
}
jQuery(document).on('click','.closePopup',function(){
jQuery('.mainPopupCart').hide(1000);
});
jQuery("input:radio[name=warehouse]:not(:disabled):first").attr('checked', true);
});