• Resolved chucklebum0205

    (@chucklebum0205)


    Hi Simon,

    Me again ?? – i’ve got a serious prob in that the plugin seems to be generating a massive amount of errors in my log file. Specifically this crops up every ten seconds or so – so much so that I had to delete a 6gb log file yesterday!

    Cannot record AddToCart event because the product cannot be determined. Backtrace: require(‘wp-blog-header.php’), require_once(‘wp-includes/template-loader.php’), include(‘/plugins/woocommerce/templates/taxonomy-product_cat.php’), wc_get_template, include(‘/themes/theretailer/woocommerce/archive-product.php’), get_header, locate_template, load_template, require_once(‘/themes/theretailer/header.php’), wp_head, do_action(‘wp_head’), WP_Hook->do_action, WP_Hook->apply_filters, wp_print_head_scripts, do_action(‘wp_print_scripts’), WP_Hook->do_action, WP_Hook->apply_filters, WC_Frontend_Scripts::localize_printed_scripts, WC_Frontend_Scripts::localize_script, WC_Frontend_Scripts::get_script_data,

    This is the limit of what’s in the log. I’ve had to put a limit into php to stop this from running but it’s only a temp fix. This seems to have been happening before my upgrade to the latest version too. The only reason I discovered it was that my auto updates had started to fail. It was because i ran out of space on my server!

    Is this something that you can look into for me?

    Kind regards

    Brian.

Viewing 15 replies - 1 through 15 (of 21 total)
  • Same problem here in the last two releases. The one that works without problems is v1.10.2

    Thanks

    Same here, hundreds of these:

    Cannot record AddToCart event because the product cannot be determined. Backtrace: require(‘wp-blog-header.php’), require_once(‘wp-includes/template-loader.php’), include(‘/themes/x/template-home.php’), get_header, locate_template, load_template, require_once(‘/themes/x/header.php’), wp_head, do_action(‘wp_head’), WP_Hook->do_action, WP_Hook->apply_filters, wp_print_head_scripts, do_action(‘wp_print_scripts’), WP_Hook->do_action, WP_Hook->apply_filters, WC_Frontend_Scripts::localize_printed_scripts, WC_Frontend_Scripts::localize_script, WC_Frontend_Scripts::get_script_data,

    Hi Brian ( @chucklebum0205 ), and @pvnanini , @kattouf,

    Thanks for letting me know about this! Sorry for the delay here, I’m not sure how this got lost in our system, I do apologize!

    The error you’ve mentioned (thanks for the stack trace by the way!) occurs in two placed, though both due to the same reason. If “redirect to cart after add” is enabled for WooCommerce, when a customer uses the AJAX functionality, it will call either:

    • woocommerce_add_to_cart_redirect
    • woocommerce_ajax_added_to_cart

    These are standard WooCommerce actions that should provide product_id or product being added.

    If you’re receiving this error, then it looks like your theme may need updating, or your theme developer may need to update their theme overrides, as the provided product or product_id is not able to be found, and so the plugin cannot track what product was added correctly. In older versions of the plugin, this caused a fatal error.

    Would it be possible to reach out to your theme developers and confirm that if they use the WooCommerce actions mentioned above, they are also passing along the product and/or product ID for the relevant actions?

    Cheers!

    Simon.

    I will contact theme developer and see what they say.

    This happens on two sites with different themes btw.

    Otherwise the themes work fine and adding to cart and ordering work just fine.

    I’l see what the one says, otherwise i will have to dig in the code an figure it out.

    /J

    Hey @kattouf,

    Thanks for letting me know! Do both themes override/use the actions I mentioned earlier? The error would only present itself if a plugin decided to hook into the WooCommerce actions and did so in the most up to date format.

    Any plugins which didn’t rely on the product_id or product for these actions would not encounter an issue, even if they weren’t up to date with the standard WooCommerce call.

    Thanks for reaching out to your theme developer, I’d love to hear if there is anything else I can provide to help them get to the bottom of it!

    Cheers,

    Simon.

    Hello Simon

    This is the answer of my theme developer:

    The7 Theme do not use these two hooks woocommerce_add_to_cart_redirect woocommerce_ajax_added_to_cart However we do override templates, but all of them already updated. please make sure you have the latest version of the theme (8.8.0) Have you confirmed it does not happen with default themes like Twentyninteen?

    I’m working with the last versions of WP, Woo and The7 theme.

    Twentytwenty Theme Error Trace

    05-19-2020 @ 10:35:03 - Cannot record AddToCart event because the product cannot be determined. Backtrace: require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/plugins/woocommerce/templates/single-product.php'), get_header, locate_template, load_template, require_once('/themes/twentytwenty/header.php'), wp_head, do_action('wp_head'), WP_Hook->do_action, WP_Hook->apply_filters, wp_print_head_scripts, do_action('wp_print_scripts'), WP_Hook->do_action, WP_Hook->apply_filters, WC_Frontend_Scripts::localize_printed_scripts, WC_Frontend_Scripts::localize_script, WC_Frontend_Scripts::get_script_data, apply_filters('woocommerce_add_to_cart_redirect'), WP_Hook->apply_filters, WC_Facebookcommerce_EventsTracker->set_last_product_added_to_cart_upon_redirect

    Let me know if I can do any other check.

    Regards,

    My theme author (for one site) said:

    It is a matter of a third party plugin which we cannot guaranty theme compatibility with our theme. You could always check with the plugin author about it.”

    Could it be another plugin interfering? i also use Google analytics for WC. I just disabled the google ad to cart event tracking. maybe it helps.

    @chucklebum0205 how did you turn off the php errors?

    Otherwise adding to cart does work.

    /J

    Ok i added pixel helper and got this when adding item to cart
    https://ibb.co/wwJNNZ7
    does that mean its working now? The add to cart event has a content id which i suppose is the product.

    Or should i be looking here?

    Button Click Automatically Detected
    CUSTOM PARAMETERS SENT
    formFeatures: Hide
    [{“id”:”pa_colours-mini”,”name”:”attribute_pa_colours-mini”,”tag”:”select”},{“id”:”quantity_5ec6efbf5dac2″,”name”:”quantity”,”tag”:”input”,”inputType”:”text”},{“id”:””,”name”:””,”tag”:”button”},{“id”:””,”name”:”add-to-cart”,”tag”:”input”,”inputType”:”hidden”},{“id”:””,”name”:”product_id”,”tag”:”input”,”inputType”:”hidden”},{“id”:””,”name”:”variation_id”,”tag”:”input”,”inputType”:”hidden”}]
    buttonText: ADD TO CART

    I get errors in the log every time. i will look into it.

    thanks

    /J

    • This reply was modified 4 years, 6 months ago by kattouf.

    Hey @kattouf and @pvnanini!

    Thanks so much for checking that with your theme developers. Let me check this with our developers, as it seems if this is happening with a default theme, then it could not be the same as the issue we saw previously with the theme using the filters.

    Thanks so much for your patience and continued involvement. I’ll circle back here as soon as I’ve had a chance to speak with them! In the meantime, could you please let me know what your store has set for the following options in WooCommerce > Settings > Products > General: https://cloud.skyver.ge/NQuD0w1o ?

    Cheers,

    Simon.

    @skyverge

    In my case is working without problems rigth now.

    Today I saw in the WPBakery Page Builder changelog that they “Fix: Ajax add to cart works properly” so I’ve upgraded both plugins and this fix the issue for me.

    I’m working with the redirect feature only.

    Cheers,

    I have it set to redirect to cart after add as I only sell one item.
    I tried with and without the ajax one.

    My theme is the StartIt theme on code canyon.

    Hi @pvnanini,

    Ah! So to confirm, you are no longer seeing the AddToCart warning being logged now that you’ve updated your page builder, theme, and Facebook for WooCommerce? Or you mean the AddToCart event is being tracked correctly, even with the warning?

    @kattouf also to confirm in your case, do you still see the error if you temporarily switch to a default theme such as TwentyTwenty as well?

    I’ve been able to replicate this locally now, and have raised this to the developers. Though it would still be interesting to see if you’re having an issue with the add to cart event being tracked, or if this is working okay and the warning is still being logged.

    Cheers!

    Simon.

    Hi @kattouf,

    I also forgot one more suggestion. If you disable debug logging with the plugin settings, that should no longer cause these warnings to be logged. Though we would still want to make sure your AddToCart event tracking is working okay.

    You can find the debug option at WooCommerce > Settings > Integration > Facebook for WooCommerce and unchecking “Enable debug mode” at the bottom of the screen.

    Cheers!

    Simon.

    Hello Simon,,

    Debug is already disabled,i never turned it on.

    I really can’t switch themes i’m sorry its a live site….

    On another site i manage the Event is TRACKED, my customer showed my the facebook stats, but error still logged.

    Even on mine also in FB event Manager the add to cart is tracked. It has “Content ID” which matches the product ids.

    The error refers to a missing “Product id”.

    So another thing. should it be logging errors with debug disabed? ??

    /J

    Hey @kattouf,

    I have been able to replicate the issue on my local site, though only when debugging was enabled. Once I turned this off, it did not log the error. Perhaps you could try enabling, saving, and then disabling this option in case the values have been corrupted in the database. It shouldn’t be logging the warning when logging is disabled from what I’ve seen!

    Thanks for confirming the tracking is working as expected, that’s some good news then! So I’ll let our developers know that the actual logging of the notice is the only issue here.

    If you could let me know if you still see the logging after toggling the debug logging in the plugin settings, that would be great.

    Cheers,

    Simon.

Viewing 15 replies - 1 through 15 (of 21 total)
  • The topic ‘Lots of add to cart events issues in logs’ is closed to new replies.