Support » Plugin: WooCommerce » get_woocommerce_term_meta is deprecated

  • Resolved jonwild

    (@jonwild)


    Hi
    Just updated to 3.6 on local copy and get the following
    Notice: get_woocommerce_term_meta is deprecated since version 3.6! Use get_term_meta instead. in C:\xampp\htdocs\[mysite]\wp-includes\functions.php on line 4329
    Can anyone advise on how to resolve?

Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Support Shane Eckert

    (@shaneeckert)

    Automattic Happiness Engineer

    Hi,

    Are you seeing this on the front end? Or is this in a log file?

    Deprecated functions are sometimes left behind for compatibility.

    Thank you.

    jonwild

    (@jonwild)

    in debug
    showing in dashboard & front end when viewing a product. Probably just me but never experienced before.

    Plugin Support Shane Eckert

    (@shaneeckert)

    Automattic Happiness Engineer

    It’s only showing because debug is enabled and verbose? Then I think you are safe to ignore it.

    Plugin Author Claudio Sanches

    (@claudiosanches)

    showing in dashboard & front end when viewing a product. Probably just me but never experienced before.

    This function is deprecated, that’s why we throw the warning you are seen, but we don’t use this function on WooCommerce anymore, so it’s probably another plugin causing it

    Plugin Support Shane Eckert

    (@shaneeckert)

    Automattic Happiness Engineer

    Thanks Claudio! Resolving this thread.

    adityab995

    (@adityab995)

    Hello sir .

    Please visit rareout.com i get 2 error and need to fix it. Please sale is going on but i don’t found a way to fix it please give steps to correct it 😞 need a help fast please

    adityab995

    (@adityab995)

    The error come qhen i update woocommerce plugin and now i didn’t find a way to resovle it please help me with stepwise process

    tandon

    (@tandon)

    I am seeing this in customizer since updating the WC plugin to 3.6.1 and I can not ignore it as I need to run WP with debug enabled… please advise.

    Plugin Author peterfabian1000

    (@peterfabian1000)

    Hi @adityab995
    I visited rareout.com and can’t see any warning?

    @tandon when we deprecate function in WC core, it takes some time until plugin authors migrate away from using the deprecated functions. If you need to run with WP_DEBUG turned on and absolutely need to hide the Notice, then you can use filter deprecated_function_trigger_error to turn off the deprecated notice, e.g.

    add_filter( ‘deprecated_function_trigger_error’, ‘__return_false’ );

    dxer

    (@dxer)

    Hello

    After I upgraded Woocommerce to 3.6 I too see this error:

    Notice: get_woocommerce_term_meta is deprecated since version 3.6! Use get_term_meta instead. in /home/MYSITE/public_html/wp-includes/functions.php on line 4329

    it is disdplaying on single product page and on category page as well.
    Not sure I understand how you solved this problem, so can you please advise.
    Thanks

    pdr

    (@philricebolivia)

    Apart from disabling verbose error reporting which should work for most , and the filter peterfabien1000 provides you can simply search for the occurrence of “get_woocommerce_term_meta” in all the files and replace it with “get_term_meta” and it should work fine , though of course make backups of any files that you change and test first on test server if you can.
    E.g. on linux run : grep -rl “get_woocommerce_term_meta” ./ from the wp-content directory then you shoudl get a list of all files that you need to change (dont change wc-deprecated-functions.php file though).
    Note that unless plugin authors dont update any files that contain this then an update could return the error.

    not helping 🙁

    I solved this by going to my wp-config.php file and changing this:

    define(‘WP_DEBUG’, true);

    to this:

    define(‘WP_DEBUG’, false);

    Hope this helps someone.

    traypup

    (@traypup)

    Thank you, @elizcardinal! That worked for me.

    My concern, though, is that the problem isn’t fixed. I’m not sure how to find out what is actually causing the error. Suggestions, anyone? Thanks!

    Riccardo

    (@riccardob-1)

    As suggested by @elizcardinal disabling the debug output it will hide the “Notice” but as @traypup said hiding doesn’t mean fixing (by the way the debug output should be disabled on a production website: less informations shown means a more secure website).

    If you really need to “fix” this “Notice” you have to search your plugins and themes for the “get_woocommerce_term_meta” function and contact the plugin/theme developer for an updated fully compatible version of it.

    If you cannot get an updated version (and you are on a WordPress at least 4.4) you have to manually replace every call to the “get_woocommerce_term_meta” function to “get_term_meta” function, PAYING ATTENTION that “get_woocommerce_term_meta” and “get_term_meta” are taking three parameters (“$term_id”, “$key” and “$single”) but “$single” is optional and on “get_woocommerce_term_meta” has a default value of “true” while on “get_term_meta” has a default value of “false”.

    This procedure could be similarly applied also on another deprecated function, the “delete_woocommerce_term_meta” that has to be replaced with “delete_term_meta”.

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