Support » Plugin: WooCommerce » “add_to_cart_fragments” – Deprecated since version 3.0.3

  • Resolved bmalott01

    (@bmalott01)


    WooCommerce – Version 3.0.3
    WooCommerce Bookings – Version 1.10.0

    Cannot access WooCommerce > Orders or WooCommerce Bookings > All Bookings. Receive HTTP Error 500.

    [16-Apr-2017 13:54:01 UTC] WordPress database error Table ‘i3425851_wp1.wp_wc_booking_relationships’ doesn’t exist for query
    SELECT posts.ID
    FROM wp_wc_booking_relationships AS relationships
    LEFT JOIN wp_posts AS posts ON posts.ID = relationships.resource_id
    WHERE relationships.product_id = 4302
    ORDER BY sort_order ASC
    made by require(‘wp-blog-header.php’), require_once(‘wp-includes/template-loader.php’), include(‘/themes/thekeynote/woocommerce.php’), woocommerce_content, wc_get_template_part, load_template, require(‘/plugins/woocommerce/templates/content-single-product.php’), do_action(‘woocommerce_after_single_product_summary’), WP_Hook->do_action, WP_Hook->apply_filters, call_user_func_array, woocommerce_output_related_products, woocommerce_related_products, wc_get_template, include(‘/plugins/woocommerce/templates/single-product/related.php’), wp_reset_postdata, WP_Query->reset_postdata, WP_Query->setup_postdata, do_action_ref_array, WP_Hook->do_action, WP_Hook->apply_filters, call_user_func_array, wc_setup_product_data, wc_get_product, WC_Product_Factory->get_product, WC_Product_Booking->__construct, WC_Product->__construct, WC_Data_Store->read, WC_Product_Booking_Data_Store_CPT->read, WC_Product_Data_Store_CPT->read, WC_Product_Booking_Data_Store_CPT->read_product_data, WC_Product_Booking_Data_Store_CPT->read_resources
    [16-Apr-2017 17:22:31 UTC] The The “add_to_cart_fragments” hook uses out of date data structures and function is deprecated since version 3.0.3. Replace with woocommerce_add_to_cart_fragments.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hey,
    Your theme doesn’t support Woocommerce 3.0 at the moment.
    You should wait until it gets updated.
    If not, and if you can access your files, you should find where the add_to_cart_fragments function is located (grep -R “add_to_cart_fragments” /path_of_your_theme).
    Then change it to the new function “woocommerce_add_to_cart_fragments”

    Hey @atx!

    I’m currently also having this issue…… How do I use (grep -R “add_to_cart_fragments” /path_of_your_theme) or how can I find where the add_to_cart_fragments function is located?

    Kind regards, J.

    Hey @janneke8incosi

    in theme: wp-content/themes/your-theme/woocommerce/woocommerce.php

    Hello @luantavares,
    Thanks for the reply. I have found wp-content/themes/your-theme/woocommerce/, but in the woocommerce file directory there is no further woocommerce.php. Only the file directories cart, checkout, emails, global, loop, my account and 5 content-php files…

    I also searched in the cart file, but no add_cart_fragments…

    Hi @janneke8incosi,

    insert the code below into functions.php
    (wp-content/themes/your-theme/functions.php)

    function replace_content($content)
    {
    $content = str_replace('add_to_cart_fragments', 'woocommerce_add_to_cart_fragments',$content);
    return $content;
    }
    add_filter('the_content','replace_content');
    • This reply was modified 1 year, 10 months ago by luantavares.

    Thanks, did that. Works fine, but got “client method denied by server configuration: ‘PURGE’ to…..”has that anything to do with the inserted code?

    And what about The WC_Cart::get_cart_url function is deprecated, The WC_Cart::get_checkout_url function is deprecated, The get_product function is deprecated and The woocommerce_get_template function is deprecated?

    Where can I find these? Or what can I change? I’m glad with your help, am/was looking for months….

    Veja esse tutorial, ensina atualizar os templates do woocommerce:

    https://docs.woocommerce.com/document/fix-outdated-templates-woocommerce/

    Thanks @luantavares, but this is about “How to update outdated templates”. I don’t have any outdated templates but still the message about these 4 deprecated functions. Can’t find them….

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘“add_to_cart_fragments” – Deprecated since version 3.0.3’ is closed to new replies.