Support » Plugin: Facebook for WooCommerce » jQuery problem

  • Resolved masterross

    (@masterross)


    I’m getting an error when using jQuery v2 and higher.

    
    Uncaught ReferenceError: jQuery is not defined

    In this section:

    <script type="text/javascript">
    jQuery(function($) { 
    /* WooCommerce Facebook Integration Event Tracking */
    fbq('track', 'ViewContent', {
        "source": "woocommerce",
        "version": "4.2.0",
        "pluginVersion": "1.11.4",
        "content_name": "\u0414\u0430\u043c\u0441\u043a\u0438 \u0441\u043c\u0430\u0440\u0442 \u0447\u0430\u0441\u043e\u0432\u043d\u0438\u043a Huawei Watch GT 2 42mm",
        "content_ids": "[\"ucrgt242_14830\"]",
        "content_type": "product",
        "value": "359",
        "currency": "BGN"
    });
     });
    </script>

    Any idea of how to fix it?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author SkyVerge

    (@skyverge)

    Hey @masterross,

    Thanks for writing in! That’s an interesting question. Would it be possible to let me know how you’ve implemented a different jQuery version so that I can try and replicate this myself? I’m wondering if this is a case of the new version being loaded after the Facebook JavaScript is written to the HTML document.

    It would need to be loaded beforehand to avoid the uncaught reference. As far as I’m aware, it still uses the jQuery and $ references even in the later releases.

    Could you let me know how you’ve implemented this so I can take a closer look to see if there is anything I can suggest?

    Cheers!

    Simon.

    Thread Starter masterross

    (@masterross)

    Hi Simon,

    Thanks for the fast reply!

    I found out that my Asset cleanup automatically defer the upgraded JS script.
    That’s why I had a problem with the FB plugin.
    Anyway, after excluding the new jquery lib from Asset cleanup it works.

    I hope this will help others with the same problem.

    Regards,
    Ross

    Plugin Author SkyVerge

    (@skyverge)

    Hey @masterross,

    Ahhh, yes! That sounds like it would be the culprit. Thanks for letting me know, sounds like you’re all sorted now.

    If you have any other questions or issues, please don’t hesitate to let me know đŸ™‚

    Cheers,

    Simon.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘jQuery problem’ is closed to new replies.