PageSourceSearch

https://mutualspecialists.com/wp-content/plugins/creote-addons/ass…/add-to-cart-ajax-single.js?ver=1790256849

js mutualspecialists.com collected 2026-09-24 13:35:19 UTC 2,662 bytes, 51 lines download raw bytes

1/*
2Nest add to cart reference
3https://wordpress.org/support/topic/ajax-add-to-cart-just-adding-1-item-instead-of-quantity-selected/
4https://stackoverflow.com/questions/65793717/ajax-add-to-cart-for-simple-and-variable-products-on-woocommerce-single-products
5https://quadlayers.com/woocommerce-ajax-add-to-cart/
6*/
7
8(function ($) {
9    "use strict";
10      $(document).ready(function() {
11            $('.product:not(.product-type-external) form.cart').on('submit', function(e) {
12                e.preventDefault();
13                var form = $(this);
14                var formData = new FormData(form[0]);
15                formData.append('add-to-cart', form.find('[name=add-to-cart]').val() );
16                $.ajax({
17                    url: wc_add_to_cart_params.wc_ajax_url.toString().replace( '%%endpoint%%', 'ace_add_to_cart' ),
18                    data: formData,
19                    type: 'POST',
20                    processData: false,
21                    contentType: false,
22                    complete: function( response ) {
23                        response = response.responseJSON;
24                        if(!response){
25                            return;
26                        }
27                        if(response.error && response.product_url){
28                            window.location = response.product_url;
29                            return;
30                        }
31                        if (wc_add_to_cart_params.cart_redirect_after_add === 'yes'){
32                            window.location = wc_add_to_cart_params.cart_url;
33                            return;
34                        }
35                        var $thisbutton = form.find('.single_add_to_cart_button'); //
36                        //var $thisbutton = null; // uncomment this if you don't want the 'View cart' button
37                        // Trigger event so themes can refresh other areas.
38                        $( document.body ).trigger( 'added_to_cart', [ response.fragments, response.cart_hash, $thisbutton ] );
39                        // Remove existing notices
40                        $( '.woocommerce-error, .woocommerce-message, .woocommerce-info' ).remove();
41                        // Add new notices
42                        $(response.fragments.notices_html).appendTo('.cart_notice').delay(800).fadeOut(800);
43                        $('.cartnotice_close').on('click', function(){
44                            $(this).closest('.woocommerce-message, .woocommerce-error').remove();
45                        });
46                    }
47                });
48            });
49        });
50        
51    }(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.