1(function($) { 2 "use strict"; 3 jQuery(function($) { 4 if (typeof wc_add_to_cart_params === 'undefined') 5 return false; 6 $(document.body).on('added_to_cart', function(a, b, c, d) { 7 8 var prod_id = d.data('product_id'); // Get the product name 9 var prod_qty = d.data('quantity'); // Get the quantity 10 var prod_name = d.data('product_name'); // Get the product name 11 var prod_img = d.data('product_image'); 12 13 14 $.ajax({ 15 type: 'POST', 16 url: wc_add_to_cart_params.ajax_url, 17 data: { 18 'action': 'item_added', 19 'id': prod_id 20 }, 21 success: function(response) { 22 if (response == prod_id) { 23 $('#pm_menu').addClass(whmcnotify.whmcpmopen); 24 $('.pm_overlay').addClass(whmcnotify.whmcpmshoe); 25 $('.pm_overlay').removeClass(whmcnotify.whmcpmhide); 26 27 } 28 } 29 }); 30 }); 31 }); 32 33 34 jQuery(function($) { 35 36 $('form.cart').on('submit', function(e) { 37 e.preventDefault(); 38 $('.single_add_to_cart_button ').addClass('whmc-spinner'); 39 $('.single_add_to_cart_button ').removeClass('added'); 40 41 var form = $(this); 42 form.block({ 43 message: null, 44 overlayCSS: { 45 background: '#fff', 46 opacity: 0.6 47 } 48 }); 49 50 var formData = new FormData(form[0]); 51 formData.append('add-to-cart', form.find('[name=add-to-cart]').val()); 52 53 // Ajax action. 54 $.ajax({
55 url: wc_add_to_cart_params.wc_ajax_url.toString().replace('%%endpoint%%', 'ace_add_to_cart'), 56 data: formData, 57 type: 'POST', 58 processData: false, 59 contentType: false, 60 complete: function(response) { 61 response = response.responseJSON; 62 63 if (!response) { 64 return; 65 } else { 66 67 $('#pm_menu').addClass(whmcnotify.whmcpmopen); 68 $('.pm_overlay').addClass(whmcnotify.whmcpmshoe); 69 $('.pm_overlay').removeClass(whmcnotify.whmcpmhide); 70 } 71 72 if (response.error && response.product_url) { 73 window.location = response.product_url; 74 return; 75 } 76 77 // Redirect to cart option 78 if (wc_add_to_cart_params.cart_redirect_after_add === 'yes') { 79 window.location = wc_add_to_cart_params.cart_url; 80 return; 81 } 82 83 var $thisbutton = form.find('.single_add_to_cart_button'); 84 $(document.body).trigger('added_to_cart', [response.fragments, response.cart_hash, $thisbutton]); 85 86 // Remove existing notices 87 $('.woocommerce-error, .woocommerce-message, .woocommerce-info').remove(); 88 89 // Add new notices 90 form.closest('.product').before(response.fragments.notices_html) 91 92 form.unblock(); 93 $('.single_add_to_cart_button ').removeClass('whmc-spinner'); 94 $('.single_add_to_cart_button ').addClass('added'); 95 96 } 97 }); 98 }); 99 }); 100 101})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.