Unfortunately due to other commitments, we are no longer able to provide support for these themes.

All our themes are now free and can be downloaded by anyone to use/modify however they wish.

We want to thank all our users for their support over the years. All the best in 2020 and beyond.

add_to_cart_fragments error in Patron

marnix_blokmarnix_blok Lifetime Member
Hello,

I was checking my site error logs in Directadmin and see the following error coming back all the time. I do not have a technical background on these matters but it seems to be related to the themedy-woocommerce.php file. Could you please check for me and let me know how to resolve this? Thanks.

Error example:
[Sun Sep 24 12:46:13.482811 2017] [lsapi:notice] [pid 893261:tid 139798215186176] [client < ip adres >:50897] [host www.mysite.com] Backend log: The The "add_to_cart_fragments" hook uses out of date data structures and function is deprecated since version 3.1.2. Replace with woocommerce_add_to_cart_fragments.\n, referer: https://www.mysite.com/zoek-je-voorbeeld-ondernemingsplan/

[Sun Sep 24 12:46:13.482977 2017] [lsapi:error] [pid 893261:tid 139798215186176] [client < ip adres >:50897] [host www.mysite.com] Backend fatal error: PHP Fatal error: Uncaught Error: Call to undefined method WC_Cart::wc_get_cart_url() in /home/deb68126/domains/mysite.com/public_html/wp-content/thesis/skins/patron-t2/lib/functions/themedy-woocommerce.php:72\nStack trace:\n#0 /home/deb68126/domains/mysite.com/public_html/wp-includes/class-wp-hook.php(298): themedy_header_add_to_cart_fragment(Array)\n#1 /home/deb68126/domains/mysite.com/public_html/wp-includes/plugin.php(244): WP_Hook->apply_filters(Array, Array)\n#2 /home/deb68126/domains/mysite.com/public_html/wp-content/plugins/woocommerce/includes/class-wc-deprecated-filter-hooks.php(90): apply_filters_ref_array('add_to_cart_fra...', Array)\n#3 /home/deb68126/domains/mysite.com/public_html/wp-content/plugins/woocommerce/includes/class-wc-deprecated-filter-hooks.php(77): WC_Deprecated_Filter_Hooks->trigger_hook('add_to_cart_fra...', Array)\n#4 /home/deb68126/domains/mysite.com/public_html/wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-deprecat in /home/deb68126/domains/mysite.com/public_html/wp-content/thesis/skins/patron-t2/lib/functions/themedy-woocommerce.php on line 72\n, referer: https://www.mysite.com/zoek-je-voorbeeld-ondernemingsplan/

Comments

  • Options
    Mark_HodderMark_Hodder Administrator, Lifetime Member
    Hi, make sure you are on the very latest version of both Patron and WooCommerce to see if that helps. If not post the URL to your site so we can check.
    Need Additional Help?
    - Check out the Resource Center for helpful tutorials and hints.


    image
  • Options
    marnix_blokmarnix_blok Lifetime Member
    Hi Mark, I'm on the latest Patron version but the error still occurs. Could you please check for me? My website is www.ondernemingsplannen.nl
  • Options
    Mark_HodderMark_Hodder Administrator, Lifetime Member
    I'll let you know what we find out although I don't think this error is effecting anything functionality wise that I can see at least.
    Need Additional Help?
    - Check out the Resource Center for helpful tutorials and hints.


    image
  • Options
    matt_hoddermatt_hodder Moderator, Lifetime Member
    For the most part is just seems like WooCommerce has switched the name of a function from "add_to_cart_fragments" to "woocommerce_add_to_cart_fragments". You are getting those log notices because of that change (although it currently does not affect any functionality). We will make the change and include it in the next Patron update.

    If you want to make the change manually, you just need to open up themedy-woocommerce.php and go to line 67 which reads:

    add_filter(add_to_cart_fragments', 'themedy_header_add_to_cart_fragment');

    and change that to

    add_filter('woocommerce_add_to_cart_fragments', 'themedy_header_add_to_cart_fragment');
  • Options
    marnix_blokmarnix_blok Lifetime Member
    Thank you for looking into this. I made the adjustment.

    Unfortunately the error did not fully dissapear. See below for the current error message I receive for every visit on my site. Could you please let me know how this can be resolved? Thanks in advance.

    [Wed Oct 18 21:24:36.805990 2017] [lsapi:error] [pid 1008158:tid 140565808805632] [client 77.163.215.163:59542] [host www.ondernemingsplannen.nl] Backend fatal error: PHP Fatal error: Uncaught Error: Call to undefined method WC_Cart::wc_get_cart_url() in /home/deb68126/domains/ondernemingsplannen.nl/public_html/wp-content/thesis/skins/patron-t2/lib/functions/themedy-woocommerce.php:72\nStack trace:\n#0 /home/deb68126/domains/ondernemingsplannen.nl/public_html/wp-includes/class-wp-hook.php(298): themedy_header_add_to_cart_fragment(Array)\n#1 /home/deb68126/domains/ondernemingsplannen.nl/public_html/wp-includes/plugin.php(203): WP_Hook->apply_filters(Array, Array)\n#2 /home/deb68126/domains/ondernemingsplannen.nl/public_html/wp-content/plugins/woocommerce/includes/class-wc-ajax.php(175): apply_filters('woocommerce_add...', Array)\n#3 /home/deb68126/domains/ondernemingsplannen.nl/public_html/wp-includes/class-wp-hook.php(298): WC_AJAX::get_refreshed_fragments('')\n#4 /home/deb68126/domains/ondernemingsplannen.nl/public_html/wp-includes/class-wp-hook.php(323): WP_Hook->apply_filters('', Array)\n#5 /home/deb68126/domains/ondernemingsplannen.nl/public_html/wp-includes/plugin.php(453): WP_Hook->do_actio in /home/deb68126/domains/ondernemingsplannen.nl/public_html/wp-content/thesis/skins/patron-t2/lib/functions/themedy-woocommerce.php on line 72\n, referer: https://www.ondernemingsplannen.nl/
  • Options
    matt_hoddermatt_hodder Moderator, Lifetime Member
    I can't seem to recreate those issues on my server. Perhaps its a server, plugin or ajax issue that's causing those errors in the log.

    You could try wrapping that function in a conditional function to check for WooCoomerce first, and it may prevent that log build up. To do that, find line 70 (in themedy-woocomerce.php) that reads:

    ob_start();

    and change it to

    if ( ! function_exists( 'is_woocommerce_activated' ) ) { ob_start();

    Then find line 74 that reads:

    $fragments['a.cart-contents'] = ob_get_clean();

    and change it to:

    $fragments['a.cart-contents'] = ob_get_clean(); }
  • Options
    marnix_blokmarnix_blok Lifetime Member
    Thanks!
This discussion has been closed.