Support » Plugin: WooCommerce UPC, EAN, and ISBN » Can not finalize purchase of kit with active “woo-add-gtin” plugin.

  • Resolved nossileee

    (@nossileee)


    Hello, how are you?

    Thank you very much for your plugin, it’s great.
    But I’m having a problem, if you can help me.

    I installed your plugin:
    https://www.wordpress.org/plugins/woo-add-gtin/

    When accessing 1 product kit, follow the link:
    https://www.bhlfitness.com.br/loja/kit-construcao-muscular-para-iniciantes/

    I select the variation (flavor) and shortly after doing this, I get the following error message:

    ——————————————————–
    Uncaught TypeError: Cannot read property ‘3360’ of undefined
    at HTMLDivElement.<anonymous> (woo-add-gtin.min.js?ver=0.1.1:1)
    at HTMLDivElement.dispatch (jquery.js?ver=1.12.4:3)
    at HTMLDivElement.r.handle (jquery.js?ver=1.12.4:3)
    at Object.trigger (jquery.js?ver=1.12.4:3)
    at Object.a.event.trigger (jquery-migrate.min.js?ver=1.4.1:2)
    at Object.e.event.trigger (migrate.js?ver=4.9.6:2)
    at HTMLDivElement.<anonymous> (jquery.js?ver=1.12.4:3)
    at Function.each (jquery.js?ver=1.12.4:2)
    at e.fn.init.each (jquery.js?ver=1.12.4:2)
    at e.fn.init.trigger (jquery.js?ver=1.12.4:3)
    ——————————————————–

    With this, I can not finalize the purchase because the page understands that the flavor was not selected, and since this is a minimum requirement, it is not possible to conclude.

    I did several tests, and when I disable the plugin “woo-add-gtin” works perfectly. When it is activated, it does not work.

    Would you help me?

    Would greatly appreciate it.

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 28 total)
  • Plugin Author Scott Bolinger

    (@scottopolis)

    Hi, I’m looking into this now, I have not been able to replicate the error.

    Did you add a GTIN to this product? If so, did you add it to the variations or just the main product? (Variations can have separate GTINs)

    Thread Starter nossileee

    (@nossileee)

    Hi Scott, I’m very happy to see you around here hehe.

    Just I activate the plugin, that error begins to occur.

    I do not need to configure any GTIN.
    The mistake is general in all the product kits that I used the “WooCommerce Composite Products” plugin of the own woocomerce.

    I will leave the plugin active now, and you can access my site for testing.

    Below is a product link to test.
    https://www.bhlfitness.com.br/loja/kit-construcao-muscular-100-pure-whey-creatina/

    I just activate and test, and can no longer finalize any purchases, says there are pending to be resolved.

    And this only occurs when the “WooCommerce UPC, EAN, and ISBN” plugin is active.
    Thank you

    Plugin Author Scott Bolinger

    (@scottopolis)

    Ok I think this might be a conflict with WooCommerce Composite Products. I can test that out if you send me a copy: support at hollerwp.com

    Thread Starter nossileee

    (@nossileee)

    Hi Scott, of course, I can send you a copy of the plugin. Would it be this?

    I’m sending a message on your site:
    https://hollerwp.com/contact/

    With the link for you to download WooCommerce Composite Products.

    My contact email is: nossileee@gmail.com

    Thank you.

    scmsteve

    (@scmsteve)

    Hi Scott, seeing this on our site as well, using WooCommerce Composite Products. If I can help debug, let me know. We had to temporarily disable your plugin. I just thought I’d add this as a data point for you so you know it wasn’t isolated to one site.

    Plugin Author Scott Bolinger

    (@scottopolis)

    Ok I’m looking into this, thanks for the report.

    Plugin Author Scott Bolinger

    (@scottopolis)

    I just tried this and it works fine for me. I created a composite product, added it to my cart, and checked out fine.

    Can you give me more specifics? Are all products having an issue, or just composite products? How is the composite product configured?

    Thanks

    Thread Starter nossileee

    (@nossileee)

    Hi Scott,

    It needs to be a composite product that has variation, example, choose size, flavor, color.

    In my case they are food supplements, then you have to choose between chocolate, vanilla, strawberry.

    And when you choose one of the flavors, they simply DO NOT IDENTIFY the choice, as if you have not yet set a flavor for the product.

    When you try to finish it, it says you need to choose a flavor, but that’s already done.

    Thank you.

    Plugin Author Scott Bolinger

    (@scottopolis)

    Ok I still wasn’t able to reproduce the issue, I was always able to check out. However, I saw a couple things that needed to be changed to support composite products, and I think this will fix any issues.

    Can you test this version out for me? https://drive.google.com/open?id=1RlMb-ykdQ_9CiMZu8-k6cfSBoh4YTet2

    Thanks!

    Thread Starter nossileee

    (@nossileee)

    Hi Scott,

    I installed this new version, activated it and tried to buy a compound product with variation of flavor, I had the same problem. It does not detect selections.

    I just made a video for you to see what happens, see him at the link below:
    https://drive.google.com/file/d/1MKHSlmdlpykJNheC4dSwB9VVGxGa4p3V/view?usp=sharing

    I believe it will be clear to understand, even though it is in Brazilian Portuguese.
    see at the end of the video, as soon as I deactivate the plugin, I return to the kit and the purchase goes ahead successfully.

    Thank you very much.

    Plugin Author Scott Bolinger

    (@scottopolis)

    Since I’m not able to replicate the error locally, I’d need to see what specific errors are happening. Are you able to open up your browser console to see if there are any errors, and also turn on wp_debug?

    scmsteve

    (@scmsteve)

    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

    Thread Starter nossileee

    (@nossileee)

    Hi Steve,

    Great, you’re ahead of me, I’ll let you settle with Scott, and I’ll be here with you, if you need me, I’ll be at your disposal.

    Thank you

    Plugin Author Scott Bolinger

    (@scottopolis)

    Ya that’s the error I saw, and the beta version I sent fixed it on my site. Are you guys using the latest version of WooCommerce?

    scmsteve

    (@scmsteve)

    We are current on all plugins on our site, WordPress as well.

    • This reply was modified 3 years ago by scmsteve.
Viewing 15 replies - 1 through 15 (of 28 total)
  • The topic ‘Can not finalize purchase of kit with active “woo-add-gtin” plugin.’ is closed to new replies.