I just upgraded my local WooCommerce website to 3.0. Everything works fine, but I noticed that during debugging I received hundreds of the following notifications:
[05-Apr-2017 12:25:00 UTC] PHP Notice: id was called <strong>incorrectly</strong>. Order properties should not be accessed directly. Please see <a href="https://codex.wordpress.org/Debugging_in_WordPress">Debugging in WordPress</a> for more information. (This message was added in version 3.0.) in C:\xampp\htdocs\dev\wp-includes\functions.php on line 4137
Thus, it seems that WooCommerce is dropping the ability to directly call order data. One example of this code is to run this function in my functions.php file:
function eden_woocommerce_order_number($original, $order) { return 'EDN-' . str_pad($order->id, 10, 0, STR_PAD_LEFT); }
This function simply adds βEDNβ to the beginning of the order identifier and fills it with 10 characters, but WooCommerce doesn't like the way I call $order - what would be the best way to rewrite such a function that 3.0 is happy with?
source share