• Resolved jamesprw

    (@jamesprw)


    After purchasing a product and using a credit card cleared by PayPal, the order was successful.. all notifications sent…product and order status in WooCommerce good.
    But there is a strange warning message that appears at the bottom of the screen that the user sees:
    Deprecated: WC_Abstract_Legacy_Order::get_product_from_item is deprecated since version 4.4.0! Use $item->get_product() instead. in /home4/xxxxxx/public_html/wp-includes/functions.php on line 4773

    What can I do about this? The customer will think there is a problem with their order.

    Thanks

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

Viewing 8 replies - 1 through 8 (of 8 total)
  • Rynald0s

    (@rynald0s)

    Automattic Happiness Engineer

    Hi @jamesprw!

    OK, so the error you see there has nothing to do with the actual payment. It is a warning stating that there is some custom code added to your site, likely in your themes’ functions.php file by the looks of it, that uses an old deprecated function.

    You would need to find that code, and then replace WC_Abstract_Legacy_Order::get_product_from_item with $item->get_product() .

    Additionally, please disable the wp_debug constant in your wp-config.php file — it can be dangerous on a live site because the text in the PHP notices can reveal details about your code, paths and other information to visitors to your site, which could attract hackers.

    You can disable that by going to your wp-config.php file and setting the define( 'WP_DEBUG', true ); constant to define( 'WP_DEBUG', false );

    Cheers!

    Thread Starter jamesprw

    (@jamesprw)

    How did this get introduced into the functions.php file? I haven’t intentionally introduced any custom code. There is no functions.php file in the root directory. Any suggestions where I can look?

    As far as the debug code, I downloaded the wp-config.php file and this is the only line that references WP_DEBUG

    define(‘WP_DEBUG’, false);
    I have changed nothing. What makes you think that might have been set to true?

    Thanks for any help on this.

    Rynald0s

    (@rynald0s)

    Automattic Happiness Engineer

    Hi @jamesprw!

    There is no functions.php file in the root directory. Any suggestions where I can look?

    The functions.php file would be in your theme folder.

    It could also be that some code has been added either via a plugin that lets you add custom code, or it could just be another plugin using the deprecated code.

    Cheers!

    Thread Starter jamesprw

    (@jamesprw)

    Well, I found a functions.php file in a theme directory however it’s not a theme I use. The theme I’m actually using doesn’t seem to be there. I’ll keep looking.
    In that fucntions.php file there is no code that starts with WC_Abstract

    Therefore I am still stuck.
    Still curious about what you said about the debug code which I don’t seem to have…

    Thread Starter jamesprw

    (@jamesprw)

    Hi again. I focused on the exact error message
    “/home4/xxxxxx/public_html/wp-includes/functions.php on line 4773”
    and found a functions.php in public_html/wp-includes

    I downloaded it.

    I found line 4773 and it contained E_USER_DEPRECATED.

    It’s clearly related to debug code. The file did not include anything starting with WC_ABSTRACT

    Also there is no wp-config.php file in that directory so I don’t know where the debug variable is getting set.

    Therefore I have not been able to make any progress.
    Any additional input is highly appreciated.
    Thanks

    Thread Starter jamesprw

    (@jamesprw)

    Hi again.
    I’ve managed to get the warning to go away. I’m not clear on exactly what was involved but I’ll explain what I did in order to hopefully assist someone in the future.
    1) I noticed that in my list of themes the actual theme I was using was not there, it was a Pro version of that theme that I had moved off on for other reasons. I removed that theme through the WP Dashboard
    2) That caused a series of errors/warnings in my robots.txt because the site structure had changed. I disabled the plugin controlling the robots.txt file (I don’t think this was actually related but it is one of the things I did).
    3) I tested another purchase and everything was fine. I used a PayPal transfer instead of a Credit Card through PayPal but I suspect this would all go through the same exit code of a completed transaction so I trust the warning message is gone.

    My conclusion is that while the site was using a free theme the folder structure reflected a Pro version and that caused some internal confusion of some kind.

    I’m considering the situation closed for now. If anything reappears I will report it seperately.
    Thanks for your help on this.

    geoj

    (@georgjoutras)

    I am getting this same message over and over in my error_log file. The message does not point to the offending plug-in unfortunately. How can I figure out who/what is calling this depreciated code???

    Thanks.

    Ilona

    (@filona)

    You can download the site onto your machine via FTP and then search the whole folder.

    In my case, it’s the WooCommerce Advanced Notifications plugin that is throwing the error (version 1.2.28)

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘WC error after payment’ is closed to new replies.