Funny, I thought my email replies would find their way back here, but they haven’t. LoL I just noticed it was noreply. Sorry.
Anyway, here is some debugging for you:
Unfortunately the beta version did not solve the problem on our site either.
Here is the JS console at crash time:
Uncaught TypeError: Cannot read property '256753' of undefined
at HTMLDivElement.<anonymous> (woo-add-gtin.min-0.3.0.js:1)
at HTMLDivElement.dispatch (jquery-1.12.4.js:3)
at HTMLDivElement.r.handle (jquery-1.12.4.js:3)
at Object.trigger (jquery-1.12.4.js:3)
at Object.a.event.trigger (jquery-migrate.min-1.4.1.js:2)
at HTMLDivElement.<anonymous> (jquery-1.12.4.js:3)
at Function.each (jquery-1.12.4.js:2)
at a.fn.init.each (jquery-1.12.4.js:2)
at a.fn.init.trigger (jquery-1.12.4.js:3)
at HTMLDivElement.a.onFoundVariation (add-to-cart-variation.min-3.4.4.js:1)
If I view source to see what is going on at that point, I see:
a.prototype.onFoundVariation = function(t, a) {
var i = t.data.variationForm
, r = i.$product.find(".product_meta").find(".sku")
, e = i.$product.find(".product_weight")
, o = i.$product.find(".product_dimensions")
, n = i.$singleVariationWrap.find(".quantity")
, s = !0
, _ = !1
, c = "";
a.sku ? r.wc_set_content(a.sku) : r.wc_reset_content(),
a.weight ? e.wc_set_content(a.weight_html) : e.wc_reset_content(),
a.dimensions ? o.wc_set_content(a.dimensions_html) : o.wc_reset_content(),
i.$form.wc_variations_image_update(a),
a.variation_is_visible ? (_ = wp.template("variation-template"),
a.variation_id) : _ = wp.template("unavailable-variation-template"),
c = (c = (c = _({
variation: a
})).replace("/*<![CDATA[*/", "")).replace("/*]]>*/", ""),
i.$singleVariation.html(c),
i.$form.find('input[name="variation_id"], input.variation_id').val(a.variation_id).change(),
"yes" === a.is_sold_individually ? (n.find("input.qty").val("1").attr("min", "1").attr("max", ""),
n.hide()) : (n.find("input.qty").attr("min", a.min_qty).attr("max", a.max_qty),
n.show()),
a.is_purchasable && a.is_in_stock && a.variation_is_visible || (s = !1),
b.trim(i.$singleVariation.text()) ? i.$singleVariation.slideDown(200).trigger("show_variation", [a, s]) : i.$singleVariation.show().trigger("show_variation", [a, s])
}
It is the last line that is triggering it, where it gets into your woo-add-gtin.min-0.3.0.js:
!function(i, n, t, a) {
var o = {};
o.init = function() {
o.variationListener()
}
,
o.variationListener = function() {
t(".single_variation_wrap").on("show_variation", function(n, a) {
if (a.variation_id) {
var o = a.variation_id;
* t(".hwp-gtin span").text(i.wooGtinVars.variation_gtins[o])
}
})
}
The asterisk marks the line that is triggering it. At this point, o is a number, and the [o] is underlined in the debugger, saying it can’t read property (the number that is in o) of undefined.
console.log(i.wooGtinVars) at this point gives:
{gtin: ""}
gtin: ""
So trying to get .variation_gtins[] on it is failing.
To be brutal, and really having no idea quite what I’m doing here, I just thought I’d test for that case and not let it happen:
woo-add-gtin.js:
15 // Fired when the user selects all the required dropdowns / attributes
16 // and a final variation is selected / shown
17 if( variation.variation_id && typeof window.wooGtinVars.variation_gtins != "undefined" ) {
18 var id = variation.variation_id;
19 $(".hwp-gtin span").text(window.wooGtinVars.variation_gtins[id]);
And this let our site/product work.
I hope this provides some insight as to what is going on, and maybe you can think of a proper fix, or tell me what further information I might be able to give you to help.
Thanks,
Steve