PageSourceSearch

https://www.atomic-ranch.com/wp-content/plugins/payment-atp/js/add-to-cart.js?ver=1790274542

js atomic-ranch.com collected 2026-09-24 18:29:46 UTC 29,137 bytes, 798 lines download raw bytes

1/*
2 * To change this license header, choose License Headers in Project Properties.
3 * To change this template file, choose Tools | Templates
4 * and open the template in the editor.
5 */
6window.addEventListener("storage", () => {
7  // When local storage changes, dump the list to
8  // the console.'
9  console.log(window.localStorage.getItem("vcart"));
10  //location.reload();
11});
12jQuery(document).ready(function ($) {
13  $(".v_overlay").on("click", function () {
14    $("body").removeClass("panel-open-cart");
15    $(".side-cart").remove();
16    $(".v_overlay").hide();
17    /* Hide login as well*/
18    // $("#et-login-form").show();
19    // $("#et-register-form,.v_overlay").hide();
20    // $("#login-register").hide();
21    // $("#success_top_reg").html("");
22    $("#username,#password,#reg_email,#password_1").val("");
23    $("#rememberme").prop("checked", false);
24  });
25  //Remove product
26  $("body").on("click", ".v_remove_product", function (e) {
27    e.preventDefault();
28    var p_this = this;
29    $(".et-cart-empty,.row.shopping-cart-content").addClass("v_loading-item");
30    $.ajax({
31      type: "POST",
32      dataType: "json",
33      url: cart_ajax_obj.ajax_url,
34      data: {
35        action: "v_remove_to_cart",
36        p_id: $(this).attr("data-product-id"),
37        attr: $(this).attr("data-attribute-id"),
38      },
39      success: function (responseData, textStatus, jqXHR) {
40        if (responseData.success == true) {
41          $(p_this).closest("li").remove();
42          $(p_this).closest("tr").remove();
43          $(".v_total_amount").html(
44            '<bdi><span class="woocommerce-Price-currencySymbol">$</span>' +
45              responseData.total_price +
46              "</bdi>"
47          );
48          $.cookie("vcart", null, { path: "/" });
49          $.cookie("vcart", responseData.cookie, { expires: 2, path: "/" });
50          $(
51            "span.item-counter.minicart-counter.et-count-zero,span.item-counter.minicart-counter"
52          ).html(responseData.total_qty);
53          window.localStorage.setItem("vcart", responseData.cookie);
54          $(".et-cart-empty,.row.shopping-cart-content").removeClass(
55            "v_loading-item"
56          );
57        } else {
58          $.cookie("vcart", null, { path: "/" });
59          $.cookie("vcoupon", null, { path: "/" });
60          window.localStorage.setItem("vcart", "");
61          $(".et-cart-empty").html(responseData.empty_cart_html);
62          $(
63            "span.item-counter.minicart-counter.et-count-zero,span.item-counter.minicart-counter"
64          ).html(0);
65          //cart page
66          $(p_this).closest("tr").remove();
67          $(".v_total_amount").html(
68            '<bdi><span class="woocommerce-Price-currencySymbol">$</span>0.00</bdi>'
69          );
70          $(
71            "table.shop_table.shop_table_responsive.cart.woocommerce-cart-form__contents > tbody"
72          ).prepend(
73            '<tr><td colspan="2"><div class="empty-circle"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-shopping-bag"><path d="M6 2L3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4z"></path><line x1="3" y1="6" x2="21" y2="6"></line><path d="M16 10a4 4 0 0 1-8 0"></path></svg></div><p class="woocommerce-mini-cart__empty-message">No products in the cart.</p></td></tr>'
74          );
75          $(".et-cart-empty,.row.shopping-cart-content").removeClass(
76            "v_loading-item"
77          );
78        }
79        return false;
80      },
81    });
82  });
83  //increse or decrese quantity
84  $("body").on(
85    "click",
86    ".product-quantity > .quantity > span.plus,.product-quantity > .quantity > span.minus",
87    function (e) {
88      var qty = $("input", $(this).closest("div.quantity")).val();
89      var p_id = $(this).closest("div.quantity").attr("data-product-id");
90      var li_this = $(this).closest("li");
91      var td_this = $(this).closest("td.et-product-details");
92
93      if ($(this).attr("class") == "minus") quantity = -1;
94      if ($(this).attr("class") == "plus") quantity = 1;
95      if ((qty > 1 && quantity == -1) || quantity == 1) {
96        $("input", $(this).closest("div.quantity")).val(
97          quantity == -1 ? qty - 1 : parseInt(qty) + 1
98        );
99        $(".et-cart-empty,.row.shopping-cart-content").addClass(
100          "v_loading-item"
101        );
102        $.ajax({
103          type: "POST",
104          dataType: "json",
105          url: cart_ajax_obj.ajax_url,
106          data: {
107            action: "v_addMinus_to_cart",
108            p_id: p_id,
109            quantity: quantity,
110            attr: $(this).attr("data-attribute-id"),
111          },
112          success: function (responseData, textStatus, jqXHR) {
113            if (responseData.success == true) {
114              $.cookie("vcart", null, { path: "/" });
115              $.cookie("vcart", responseData.cookie, { expires: 2, path: "/" });
116              window.localStorage.setItem("vcart", responseData.cookie);
117              $(".v_total_amount").html(
118                '<bdi><span class="woocommerce-Price-currencySymbol">$</span>' +
119                  responseData.total_price +
120                  "</bdi>"
121              );
122              $(
123                "div.et-cart-panel-item-details > div.et-cart-panel-quantity-pricing > div.et-cart-panel-item-subtotal >
123 span.woocommerce-Price-amount.amount > bdi",
124                li_this
125              ).html(
126                '<span class="woocommerce-Price-currencySymbol">$</span>' +
127                  parseFloat(
128                    parseFloat(responseData.click_product_price) *
129                      (parseFloat(qty) + quantity)
130                  ).toFixed(2)
131              );
132              $(
133                "div.row > div.product-subtotal > span.woocommerce-Price-amount.amount > bdi",
134                td_this
135              ).html(
136                '<span class="woocommerce-Price-currencySymbol">$</span>' +
137                  parseFloat(
138                    parseFloat(responseData.click_product_price) *
139                      (parseFloat(qty) + quantity)
140                  ).toFixed(2)
141              );
142              $(
143                "span.item-counter.minicart-counter.et-count-zero,span.item-counter.minicart-counter"
144              ).html(responseData.total_qty);
145              $(".et-cart-empty,.row.shopping-cart-content").removeClass(
146                "v_loading-item"
147              );
148            }
149            return false;
150          },
151        });
152      }
153    }
154  );
155  //add to cart
156  $("body").on("click", ".add_to_cart", function (e) {
157    e.preventDefault();
158    $(".v_overlay").show().addClass("v_loading-item");
159    $.ajax({
160      type: "POST",
161      dataType: "json",
162      url: cart_ajax_obj.ajax_url,
163      data: {
164        action: "v_add_to_cart",
165        p_id: $(this).attr("data-product-id"),
166        qty: $(this).attr("data-quantity"),
167        attr: $(this).attr("data-attribute-id"),
168      },
169      success: function (responseData, textStatus, jqXHR) {
170        $(".v_overlay").removeClass("v_loading-item");
171        $.cookie("vcart", null, { path: "/" });
172        $.cookie("vcart", responseData.cookie, { expires: 2, path: "/" });
173        window.localStorage.setItem("vcart", responseData.cookie);
174        $("#side-cart").remove();
175        let items = JSON.parse(responseData.items);
176        let totalProQuantity = 0;
177        for (let i = 0; i < items.length; ++i)
178          totalProQuantity = totalProQuantity + parseInt(items[i].quantity);
179        $("span.item-counter.minicart-counter").html(totalProQuantity);
180        $("body").append(responseData.html);
181        $("body").addClass("panel-open-cart");
182        /*
183                gtag("event", "add_to_cart", {
184                currency: "USD",
185                value:responseData.value,
186                items: responseData.items
187              });*/
188      },
189    });
190  });
191  //continue shopping
192  $("body").on(
193    "click",
194    ".button.outlined.btn-sm.cart-continue-shopping,.checkout-button.button.alt.wc-forward,.button.continue-shopping,.button.checkout.wc-forward",
195    function (e) {
196      $(".v_overlay").addClass("v_loading-item").show();
197    }
198  );
199  $("body").on("click", ".et-close,#continue-shopping", function (e) {
200    e.preventDefault();
201    if (window.location.href.indexOf("cart") > -1) {
202      location.reload();
203    }
204    $("body").removeClass("panel-open-cart");
205    $(".side-cart").remove();
206    $(".v_overlay").hide();
207  });
208
209  /*
210   * Login and register functionality
211   */
212  //   $("#login,.mobile-login").on("click", function (e) {
213  //     e.preventDefault();
214  //     $("#login-register,.v_overlay").show();
215  //   });
216  //   $(".login-page-register-link").on("click", function (e) {
217  //     e.preventDefault();
218  //     $("#et-login-form").hide();
219  //     $("#success_top_reg").html("");
220  //     $("#et-register-form,.v_overlay").show();
221  //     $("#login-register").show();
222  //   });
223  //   $("#head-close").on("click", function () {
224  //     $("#et-login-form").show();
225  //     $("#et-register-form,.v_overlay").hide();
226  //     $("#login-register").hide();
227  //     $("#success_top_reg").html("");
228  //     $("#username,#password,#reg_email,#password_1,#password_2").val("");
229  //     $("#rememberme").prop("checked", false);
230  //   });
231  //   $(".register-link").on("click", function (e) {
232  //     e.preventDefault();
233  //     $("#success_top_reg").html("");
234  //     $("#et-login-form").hide();
235  //     $("#et-register-form,.v_overlay").show();
236  //     $("#reg_email,#password_1,#password_2").val("");
237  //   });
238  //   $(".login-link").on("click", function (e) {
239  //     e.preventDefault();
240  //     $("#et-register-form").hide();
241  //     $("#et-login-form,.v_overlay").show();
242  //     $("#username,#password").val("");
243  //     $("#rememberme").prop("checked", false);
244  //   });
245
246  $("#login_form").on("submit", function (e) {
247    e.preventDefault();
248    $("#username_error,#password_error,#error_top").html("");
249    if ($("#username").val() == "") {
250      $("#username_error").html("Enter email id");
251      return;
252    }
253    if ($("#password").val() == "") {
254      $("#password_error").html("Enter password");
255      return;
256    }
257    jQuery(".v_overlay").show().addClass("v_loading-item");
258
259    $.ajax({
260      type: "POST",
261      dataType: "json",
262      url: cart_ajax_obj.ajax_url,
263      data: {
264        action: "vc_ajax_login",
265        username: $("#username").val(),
266        password: $("#password").val(),
267        remember: $("#rememberme").val(),
268        nonce: cart_ajax_obj.nonce,
269      },
270      success: function (responseData, textStatus, jqXHR) {
271        if (responseData.success == true) {
272          window.location.href = responseData.url;
273        } else {
274          $("#error_top").html(responseData.error);
275          jQuery(".v_overlay").removeClass("v_loading-item").hide();
276        }
277      },
278      error: function (jqXHR, textStatus, errorThrown) {
279        console.log(textStatus, errorThrown);
280        jQuery(".v_overlay").removeClass("v_loading-item").hide();
281    },
282    });
283  });
284  $("#register_form").on("submit", function (e) {
285    e.preventDefault();
286    jQuery(".v_overlay").show().addClass("v_loading-item");
287    $("#success_top_reg,#error_top_reg").html("");
288    $("#reg_email_error,#password_1_error,#billing_phone_error").html("");
289    if ($("#reg_email").val() == "") {
290      $("#reg_email_error").html("Enter email id");
291      jQuery(".v_overlay").removeClass("v_loading-item").hide();
292      return;
293    }
294    if ($("#password_1").val() == "") {
295      $("#password_1_error").html("Enter password");
296      jQuery(".v_overlay").removeClass("v_loading-item").hide();
297      return;
298    }
299    let email = $("#reg_email").val();
300    let password_1 = $("#password_1").val();
301    let billing_phone = $("#billing-phone").val();
302    let nonce = cart_ajax_obj.nonce;
303    $.ajax({
304      type: "POST",
305      dataType: "json",
306      url: cart_ajax_obj.ajax_url,
307      data: {
308        action: "vc_ajax_register",
309        email: email,
310        password_1: password_1,
311        billing_phone: billing_phone,
312        nonce: nonce,
313      },
314      success: function (responseData, textStatus, jqXHR) {
315        if (responseData.success == true) {
316          $("#success_top_reg").html(responseData.msg);
317          $("#username,#password,#reg_email,#password_1").val("");
318          $("#rememberme").prop("checked", false);
319        } else $("#error_top_reg").html(responseData.error);
320        jQuery(".v_overlay").removeClass("v_loading-item").hide();
321      },
322      error: function (jqXHR, textStatus, errorThrown) {
323        console.log(textStatus, errorThrown);
324        jQuery(".v_overlay").removeClass("v_loading-item").hide();
325      },
326    });
327  });
328
329  // We can also pass the url value separately from ajaxurl for front end AJAX implementations
330
331  $("body").on("click", "#format li", function (e) {
332    e.preventDefault();
333    var sel_form = $(this).closest(".product-information");
334
335    var prd_id = $(this).attr("data-product");
336    var qty = $("#quantity").val();
337    var prd_type = $(this).attr("title");
338    var product_type = $(this).attr("product-type");
339    if (prd_id != "") {
340      $(sel_form).addClass("v_loading-item");
341      $.ajax({
342        type: "POST",
343        data: {
344          action: "get_product_duration",
345          product_id: prd_id,
346          product_type: product_type,
347        },
348        url: base_url + "/wp-admin/admin-ajax.php",
349        success: function (value) {
350          $("#duration_ajx").html(value);
351          var prd_du = $("#prd_du").val();
352          var price = $("#prc_val").val();
353          var coprice = $("#co_val").val();
354
355          if (coprice > 0) {
356            var save = ((coprice - price) * 100) / coprice;
357          } else {
358            var save = 0;
359          }
360          //var save=((coprice - price)*100)/coprice;
361          var attr_id = jQuery("#attr").val();
362          $("#sel_du").html(prd_du);
363          $("#prc").html(price);
364          $("#google_tags").html(
365            '<script type="text/javascript">gtag("event", "view_item", {currency: "USD", value: ' +
366              price +
367              ",});</script>"
368          );
369          //$('#cp').html(coprice);
370          //$('#sav').html(Math.round(save));
371          if (coprice > 0) {
372            $(".discount-price").show();
373            $(".total-discount").show();
374            $("#cp").html(coprice);
375            $("#sav").html(Math.round(save));
376          } else {
377            $(".discount-price").hide();
378            $(".total-discount").hide();
379          }
380
381          $(".add_to_cart").attr("data-product-id", +prd_id);
382          $(".add_to_cart").attr("data-quantity", +qty);
383          $(".add_to_cart").attr("data-attribute-id", attr_id);
384          if ($("ol.flex-control-nav > li").length >= 3) {
385            if (prd_type == "Print") {
386              $("ol.flex-control-nav > li:nth-child(1) > img").trigger("click");
387            } else if (prd_type == "Digital") {
388              $("ol.flex-control-nav > li:nth-child(2) > img").trigger("click");
389            } else {
390              $("ol.flex-control-nav > li:nth-child(3) > img").trigger("click");
391            }
392          } else {
393            if (prd_type == "Print") {
394              $("ol.flex-control-nav > li:nth-child(1) > img").trigger("click");
395            } else if (prd_type == "Digital") {
396              $("ol.flex-control-nav > li:nth-child(2) > img").trigger("click");
397            }
398          }
399          $(sel_form).removeClass("v_loading-item");
400        },
401      });
402    }
403
404    var sort = $(this).attr("title");
405    $("#sel_format").html(sort);
406
407    $(this).addClass("selected").siblings().removeClass("selected");
408  });
409
410  $("body").on("click", "#duration li", function (e) {
411    e.preventDefault();
412    var sel_form = $(this).closest("form");
413    $(sel_form).addClass("v_loading-item");
414    var sort = $(this).attr("title");
415    var option_id = $(this).attr("data-value");
416    var qty = $("#quantity").val();
417    $("#sel_du").html(sort);
418    $(this).addClass("selected").siblings().removeClass("selected");
419    var price = $(this).attr("prc_val");
420    var coprice = $(this).attr("co_val");
421
422    if (coprice > 0) {
423      var save = ((coprice - price) * 100) / coprice;
424    } else {
425      var save = 0;
426    }
427
428    //var save=((coprice - price)*100)/coprice;
429    $("#prc").html(price);
430    $("#google_tags").html(
431      '<script type="text/javascript">gtag("event", "view_item", {currency: "USD", value: ' +
432        price +
433        ",});</script>"
434    );
435    // $('#cp').html(coprice);
436    //$('#sav').html(Math.round(save));
437    if (coprice > 0) {
438      $(".discount-price").show();
439      $(".total-discount").show();
440      $("#cp").html(coprice);
441      $("#sav").html(Math.round(save));
442    } else {
443      $(".discount-price").hide();
444      $(".total-discount").hide();
445    }
446
447    $(".add_to_cart").attr("data-attribute-id", +option_id);
448    $(".add_to_cart").attr("data-quantity", +qty);
449    $(sel_form).removeClass("v_loading-item");
450  });
451
452  $("body").on("click", "#format_sing li", function (e) {
453    e.preventDefault();
454    var sel_form = $(this).closest(".product-information");
455    $(sel_form).addClass("v_loading-item");
456    var prd_id = $(this).attr("data-product");
457    var prd_type = $(this).attr("title");
458    var prd_stock = $(this).attr("data-stock");
459    var qty = $("#quantity").val();
460
461    if (prd_id != "") {
462      $.ajax({
463        type: "POST",
464        data: { action: "get_product_price", product_id: prd_id },
465        url: base_url + "/wp-admin/admin-ajax.php",
466        success: function (value) {
467          $("#prc").html(value);
468          $("#google_tags").html(
469            '<script type="text/javascript">gtag("event", "view_item", {currency: "USD", value: ' +
470              value +
471              ",});</script>"
472          );
473          $(".add_to_cart").attr("data-quantity", +qty);
474          $(".add_to_cart").attr("data-product-id", +prd_id);
475          if (prd_type == "Print") {
476            $("ol.flex-control-nav > li:nth-child(1) > img").trigger("click");
477          }
478          if (prd_type == "Digital") {
479            $("ol.flex-control-nav > li:nth-child(2) > img").trigger("click");
480          }
481          $(sel_form).removeClass("v_loading-item");
482        },
483      });
484    }
485
486    var sort = $(this).attr("title");
487    $("#sel_format").html(sort);
488    $(this).addClass("selected").siblings().removeClass("selected");
489    if (prd_type == "Print" && prd_stock == 0) {
490      $("#crt").hide();
491      $("#out-stock").show();
492    } else {
493      $("#crt").show();
494      $("#out-stock").hide();
495    }
496  });
497
498  $("body").on("click", "#format_ft li", function (e) {
499    e.preventDefault();
500    var prd_id = $(this).attr("data-product");
501    var prd_type = $(this).attr("title");
502    var prd_stock = $(this).attr("data-stock");
503    var qty = $("#quty").val();
504    if (prd_id != "") {
505      $.ajax({
506        type: "POST",
507        data: { action: "get_product_duration_ft", product_id: prd_id },
508        url: base_url + "/wp-admin/admin-ajax.php",
509        success: function (value) {
510          $("#duration_ajx_ft").html(value);
511          $(".add_to_cart").attr("data-product-id", +prd_id);
512          $(".add_to_cart").attr("data-quantity", +qty);
513        },
514      });
515    }
516    var sort = $(this).attr("title");
517    $("#sel_format_ft").html(sort);
518    $(this).addClass("selected").siblings().removeClass("selected");
519    if (prd_type == "Print" && prd_stock == 0) {
520      $("#crt_ft").hide();
521      $("#out-stock_ft").show();
522    } else {
523      $("#crt_ft").show();
524      $("#out-stock_ft").hide();
525    }
526  });
527
528  $("body").on("click", "#duration_ft li", function (e) {
529    var sort = $(this).attr("title");
530    var option_id = $(this).attr("data-value");
531    var qty = $("#quty").val();
532    $(".add_to_cart").attr("data-attribute-id", +option_id);
533    $(".add_to_cart").attr("data-quantity", +qty);
534    $("#sel_du_ft").html(sort);
535    $(this).addClass("selected").siblings().removeClass("selected");
536  });
537  $("body").on("click", ".quantity_top .minus", function (e) {
538    var qty = Number($("#quantity").val());
539    if (qty - 1 != 0) {
540      qty = qty - 1;
541      $(".add_to_cart").attr("data-quantity", +qty);
542      $("#quantity").val(qty);
543    }
544  });
545  $("body").on("click", ".qty_ft .minus", function (e) {
546    var qty = Number($("#quty").val());
547    if (qty - 1 != 0) {
548      qty = qty - 1;
549      $(".add_to_cart").attr("data-quantity", +qty);
550    }
551  });
552
553  $("body").on("click", ".quantity_top .plus", function (e) {
554    var qty = Number($("#quantity").val());
555    qty = qty + 1;
556    $(".add_to_cart").attr("data-quantity", +qty);
557    $("#quantity").val(qty);
558  });
559  $("body").on("click", ".qty_ft .plus", function (e) {
560    var qty = Number($("#quty").val());
561    qty = qty + 1;
562    $(".add_to_cart").attr("data-quantity", +qty);
563  });
564
565  /// Add on Product checkbox
566  jQuery(".product-checkbox").change(function() {
567    var selectedLi = $('li.selected');
568
569    var prcVal = selectedLi.attr('prc_val');
570    var coVal = selectedLi.attr('co_val');
571
572    var selectedProductIds = [];
573    //var variation_id = jQuery(".variation_id").val();	
574    var productId = jQuery('input[name="product_id"]').val();	
575
576      
577    var sel_form = $(this).closest('.product-information');
578    $(sel_form).addClass("v_loading-item");
579      
580    jQuery(".product-checkbox:checked").each(function() {
581        selectedProductIds.push(jQuery(this).val());
582    });    
583    var selectedCount = selectedProductIds.length;
584    
585    $.ajax({
586      type: "POST",
587      data: { action: "get_selected_product_prices", 
588              child_product_ids: selectedProductIds,
589              product_id: productId,
590              prcVal: prcVal,
591              coVal: coVal
592            },
593      url: base_url + "/wp-admin/admin-ajax.php",
594      success: function (value) {
595       
596        $(".price").html(value);
597        if(selectedCount > 0){
598          var total_length = selectedCount+1;
599            $("ol.flex-control-nav > li:nth-child("+total_length+") > img").trigger("click");
600        }        
601        else{
602            $("ol.flex-control-nav > li:nth-child(1) > img").trigger("click");
603        }
604        $(sel_form).removeClass("v_loading-item");
605      }
606    })
607    
608  });
609  $("body").on("click", ".button-variable-item-xs", function (e) {
610    var prcVal = $(this).attr('prc_val');
611    var coVal  = $(this).attr('co_val');
612    // var ariaChecked = $(this).attr('aria-checked');
613    // alert(ariaChecked)
614    // var title = $(this).attr('title');
615    var attribute_id = $(this).data('value');
616    $('.single_add_to_cart_button').attr('data-attribute-id', attribute_id);
617    var productId = jQuery('input[name="product_id"]').val();	
618    if ($('#add_on_pro').is(':checked')) {
619        var checkboxvalue = jQuery("#add_on_pro").val();
620        var sel_form = $(this).closest('.product-information');
621        $(sel_form).addClass("v_loading-item");
622        $.ajax({
623          type: "POST",
624          data: { action: "get_selected_product_term_prices", 
625                  child_product_ids: checkboxvalue,
626                  product_id: productId,
627                  prcVal: prcVal,
628                  coVal: coVal
629                },
630          url: base_url + "/wp-admin/admin-ajax.php",
631          success: function (value) {
632            $(".price").html(value);  
633            $(sel_form).removeClass("v_loading-item");
634                          
635          }
636        })
637    } 
638
639  });
640
641  /// Add on Single Product checkbox
642  jQuery(".product-checkbox-single").change(function() {
643      
644    var selectedProductIds = [];
645    //var variation_id = jQuery(".variation_id").val();	
646    var productId = jQuery('input[name="product_id"]').val();	
647
648      
649    var sel_form = $(this).closest('.product-information');
650    $(sel_form).addClass("v_loading-item");
651      
652    jQuery(".product-checkbox-single:checked").each(function() {
653        selectedProductIds.push(jQuery(this).val());
654    });    
655    var selectedCount = selectedProductIds.length;
656    
657    $.ajax({
658      type: "POST",
659      data: { action: "get_selected_product_prices_single", 
660              child_product_ids: selectedProductIds,
661              product_id: productId 
662            },
663      url: base_url + "/wp-admin/admin-ajax.php",
664      success: function (value) {
665        $(sel_form).removeClass("v_loading-item");
666        $(".price").html(value);
667        if(selectedCount > 0){
668          var total_length = selectedCount+1;
669            $("ol.flex-control-nav > li:nth-child("+total_length+") > img").trigger("click");
670        }        
671        else{
672            $("ol.flex-control-nav > li:nth-child(1) > img").trigger("click");
673        }
674      }
675    })
676        
677    
678  });
679  //add on & expired product to cart
680  $("body").on("click", ".addon_addtocart", function (e) {
681    e.preventDefault();
682    $(".v_overlay").show().addClass("v_loading-item");
683    var selectedProductIds = [];
684    jQuery(".product-checkbox:checked").each(function() {
685      selectedProductIds.push(jQuery(this).val());
686    });    
687     var selectedCount = selectedProductIds.length;
688      
689    var pro_id = $(this).attr("data-product-id");
690    $.ajax({
691      type: "POST",
692      dataType: "json",
693      url: cart_ajax_obj.ajax_url,
694      data: {
695        action: "v_add_to_cart",
696        p_id: $(this).attr("data-product-id"),
697        qty:  $(this).attr("data-quantity"),
698        attr: $(this).attr("data-attribute-id"),         
699      },
700      success: function (responseData, textStatus, jqXHR) {
701        // console.log(responseData);           
702        $.cookie("vcart", null, { path: "/" });
703        $.cookie("vcart", responseData.cookie, { expires: 2, path: "/" });
704        window.localStorage.setItem("vcart", responseData.cookie); 
705        if(selectedCount == 0){
706          window.location.href = '/checkout';
707          $(".v_overlay").hide();
708          $(".v_overlay").removeClass("v_loading-item");          
709        }            
710        if(selectedCount > 0){
711          $.ajax({
712            type: "POST",
713            dataType: "json",
714            url: cart_ajax_obj.ajax_url,
715            data: {
716              action: "addon_add_to_cart",
717              p_id: pro_id,              
718              child_product_ids: selectedProductIds,
719            },
720              success: function (responseData, textStatus, jqXHR) {         
721                $.cookie("vcart", null, { path: "/" });
722                $.cookie("vcart", responseData.cookie, { expires: 2, path: "/" });
723                window.localStorage.setItem("vcart", responseData.cookie);
724                window.location.href = '/checkout';
725                $(".v_overlay").hide();
726                $(".v_overlay").removeClass("v_loading-item");
727              }
728          });
729        }      
730      },
731    });
732  });
733
734  //add on & expired product to cart
735  $("body").on("click", ".addon_addtocart_single", function (e) {
736    e.preventDefault();
737    $(".v_overlay").show().addClass("v_loading-item");
738    var selectedProductIds = [];
739    jQuery(".product-checkbox-single:checked").each(function() {
740      selectedProductIds.push(jQuery(this).val());
741    });      
742    var selectedCount = selectedProductIds.length;     
743    
744    $.ajax({
745      type: "POST",
746      dataType: "json",
747      url: cart_ajax_obj.ajax_url,
748      data: {
749        action: "v_add_to_cart",
750        p_id: $(this).attr("data-product-id"),
751        qty:  $(this).attr("data-quantity"),
752        attr: $(this).attr("data-attribute-id"),         
753      },
754      success: function (responseData, textStatus, jqXHR) {
755        // console.log(responseData);           
756        $.cookie("vcart", null, { path: "/" });
757        $.cookie("vcart", responseData.cookie, { expires: 2, path: "/" });
758        window.localStorage.setItem("vcart", responseData.cookie); 
759        if(selectedCount == 0){
760          window.location.href = '/checkout';
761          $(".v_overlay").hide();
762          $(".v_overlay").removeClass("v_loading-item");          
763        }            
764        if(selectedCount > 0){          
765          var loopCount = 0;
766          productId = '';
767          selectedProductIds.forEach(function(productId) {  
768            loopCount++;  
769               
770              $.ajax({
771                type: "POST",
772                dataType: "json",
773                url: cart_ajax_obj.ajax_url,
774                data: {
775                  action: "v_add_to_cart",
776                  p_id: productId,
777                  qty:  1,
778                  attr: 0,                  
779                },
780                  success: function (responseData, textStatus, jqXHR) {         
781                    $.cookie("vcart", null, { path: "/" });
782                    $.cookie("vcart", responseData.cookie, { expires: 2, path: "/" });
783                    window.localStorage.setItem("vcart", responseData.cookie);
784                   
785                  }
786              });      
787            if(loopCount == selectedCount){                 
788              $(".v_overlay").hide();
789              $(".v_overlay").removeClass("v_loading-item");
790              window.location.href = '/checkout';
791            }
792          });
793          
794        }      
795      },
796    });
797  });
798});

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.