jQuery(document).ready(function (e) { e(".order_bump_set").length && e("input#bc_order_bump").prop("checked", !0), e("input#bc_order_bump").change(function () { if (this.checked) var r = "true"; else r = "false"; if (e(".variation_is_here").length) { var a = {}, t = e(this).closest(".variations_form"); check = !0, variations = t.find("select[name^=attribute]"), variations.length || (variations = t.find("[name^=attribute]:checked")), variations.length || (variations = t.find("input[name^=attribute]")), e(".variations_form select[name^=attribute]").each(function (r, t) { var i, o, n = e(this), c = n.attr("name"), d = n.val(); n.removeClass("error"), 0 === d.length ? (i = c.lastIndexOf("_"), o = c.substring(i + 1), n.addClass("required error").before('<div class="ajaxerrors"><p>Please select ' + o + "</p></div>"), check = !1) : a[c] = d }); var i = e(".bc_order_bump_cont .product_id").val(), o = e(".bc_order_bump_cont .variation_id").val(), n = e(".bc_order_bump_cont .main_product_id").val(), c = e(".bc_order_bump_cont .variation_is_here").val(), d = a } else i = e(".bc_order_bump_cont .product_id").val(), n = e(".bc_order_bump_cont .main_product_id").val(), o = "none", c = "none", d = ""; data = { action: "divi_bodycommerce_orderbump_handler", product_id: i, main_product_id: n, variation_id: o, variation: c, variation_data: d, added: r }, jQuery.ajax({ url: ajax_object.ajax_url, data: data, type: "POST", beforeSend: function (e) { jQuery("body").trigger("update_checkout") }, success: function (e) { e && jQuery("body").trigger("update_checkout") } }) }) });