Support » Plugin: Jetpack - WP Security, Backup, Speed, & Growth » Fatal Error in Jetpack Woocommerce Analytics

  • Resolved braetelliot

    (@braetelliot)


    Currently, my users are facing the following issue:

    When a user has logged in, and tries to view the product details page on my woocommerce enabled ecommerce site, they are faced with a fatal error, and are unable to view the product. However, when the user is not logged in, and is viewing the website as a guest, there is no issue, and they are able to view the product just fine. The error displayed is copied below

    Fatal error: Uncaught Error: Call to a member function get_id() on null in /home/customer/www/boundbywine.com/public_html/wp-content/plugins/jetpack/modules/woocommerce-analytics/classes/class-jetpack-woocommerce-analytics-universal.php:242 Stack trace: #0 /home/customer/www/boundbywine.com/public_html/wp-includes/class-wp-hook.php(287): Jetpack_WooCommerce_Analytics_Universal->capture_product_view(”) #1 /home/customer/www/boundbywine.com/public_html/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(”, Array) #2 /home/customer/www/boundbywine.com/public_html/wp-includes/plugin.php(484): WP_Hook->do_action(Array) #3 /home/customer/www/boundbywine.com/public_html/wp-content/plugins/elementor-pro/modules/woocommerce/documents/product.php(105): do_action(‘woocommerce_aft…’) #4 /home/customer/www/boundbywine.com/public_html/wp-content/plugins/elementor-pro/modules/theme-builder/documents/theme-document.php(72): ElementorPro\Modules\Woocommerce\Documents\Product->after_get_content() #5 /home/customer/www/boundbywin in /home/customer/www/boundbywine.com/public_html/wp-content/plugins/jetpack/modules/woocommerce-analytics/classes/class-jetpack-woocommerce-analytics-universal.php on line 242

    Please advise on solutions to overcome this. Thank you!

    • This topic was modified 8 months, 1 week ago by braetelliot.

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

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Contributor csonnek

    (@csonnek)

    Happiness Rocketeer šŸš€

    Thanks for reaching out! While the file mentions Jetpack, the file itself is in the WooCommmerce plugin.

    I did a quick search of their support forum and it looks like it might be a conflict with your theme – or based on the error, a conflict with Elementor Pro? Link to forum post.

    If what they suggest in that thread doesn’t help, please open a new thread on their forum and they’ll be able to help you narrow down the issue.

    https://wordpress.org/support/plugin/woocommerce/#new-topic-0

    Since this is not a Jetpack issue, but a WooCommerce one, we’ll mark this resolved.

    Thread Starter braetelliot

    (@braetelliot)

    Hi @csonnek ,

    So I’ve tried to test out updating theme files, disabling plugins, etc. Only when I remove the Jetpack connection, the issue seems to disappear.

    As such, I believe it could be an issue with the Jetpack plugin. Please advise

    Plugin Contributor Dan (a11n)

    (@drawmyface)

    Hi @braetelliot it sounds like a conflict between Jetpack and Elementor. Does the issue disappear if you keep Jetpack active and deactivate Elementor?

    Thread Starter braetelliot

    (@braetelliot)

    @csonnek yes it still exists unfortunately. I tried deactivating both elector pro and elementor, still exists after both

    Plugin Contributor Dan (a11n)

    (@drawmyface)

    @braetelliot I haven’t been able to reproduce this issue on a test site running only Jetpack and WooCommerce, with the Twenty Twenty theme. In order to troubleshoot further, we’d need you to create a staging site with only those plugins/theme active.

    Could you contact us via this contact form and mention this thread so we can assist further?

    Thread Starter braetelliot

    (@braetelliot)

    @drawmyface I’ve found a way around this, by replacing line 242 of plugins/jetpack/modules/woocommerce-analytics/classes/class-jetpack-woocommerce-analytics-universal.php from

    $product->get_id()

    to

    $product->ID

    ===

    Personally I don’t understand how this would fix it, but please do consider.

    Plugin Contributor Dan (a11n)

    (@drawmyface)

    Hi @braetelliot – It seems there may be another plugin on your site modifying how product data is stored by WooCommerce, but Jetpack expects properly formatted data.

    We are tracking this issue here:
    https://github.com/Automattic/jetpack/issues/11301

    For now, you could deactivate Jetpack’s WooCommerce Analytics module if you don’t need it. You can do that as described here:

    https://jetpack.com/support/control-jetpack-features-on-one-page/

    We’re getting this same PHP fatal error using Elementor Pro :: Theme Builder :: Single Product (template), but only for the WooCommerce “Shop Manager” user role.

    To trigger the error, match the above conditions then click into Elementor Pro > Templates > Theme Builder > Single Product > [single entry].

    Likely not reproducible with the free Elementor plugin as the stack trace here looks to be product related.

    The Fatal error is within JetPack so the fix would have to be on that side in file class-jetpack-woocommerce-analytics-universal.php to bail upon empty product global variable.

    Viewing an Elementor Pro product template means previewing a specific product within it (selected in the template’s page settings area). This works admin side but not on the front end using the Shop Manager capabilities.

    This PHP error looks different that the one within the GitHub link I see above, though not sure whether they may be related in some way.

    As this does not reproduce for Administrators, I suspect a capability added to the Shop Manager role may wor around this problem. I’ll follow-up if I find a reasonable capability that does the trick.

    Our error log is:

    PHP Fatal error: Uncaught Error: Call to a member function get_id() on null in /nas/content/live/CLIENT/wp-content/plugins/jetpack/modules/woocommerce-analytics/classes/class-jetpack-woocommerce-analytics-universal.php:242\nStack trace:\n#0 /nas/content/live/CLIENT/wp-includes/class-wp-hook.php(292): Jetpack_WooCommerce_Analytics_Universal->capture_product_view('')\n#1 /nas/content/live/CLIENT/wp-includes/class-wp-hook.php(316): WP_Hook->apply_filters('', Array)\n#2 /nas/content/live/CLIENT/wp-includes/plugin.php(484): WP_Hook->do_action(Array)\n#3 /nas/content/live/CLIENT/wp-content/plugins/elementor-pro/modules/woocommerce/documents/product.php(123): do_action('woocommerce_aft...')\n#4 /nas/content/live/CLIENT/wp-content/plugins/elementor-pro/modules/theme-builder/documents/theme-document.php(189): ElementorPro\\Modules\\Woocommerce\\Documents\\Product->after_get_content()\n#5 /nas/content/live/CLIENT/wp-content/plugins/elementor-pro/modules/theme-builder/documents/theme-document.php(200): ElementorPro\\Modules\\ThemeBuilder\\Docu in /nas/content/live/CLIENT/wp-content/plugins/jetpack/modules/woocommerce-analytics/classes/class-jetpack-woocommerce-analytics-universal.php on line 242

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.