Patch for warning about accessing order ID directly
-
As reported by someone else, there is a notice in the server logs:
[notice] [client ] id was called incorrectly. Order properties should not be accessed directly. Backtrace: do_action(‘wp_ajax_woocos_setup_deactivation_form_ajaxPost’), WP_Hook->do_action, WP_Hook->apply_filters, call_user_func_array, woocos_setup_deactivation_form_ajaxPost, WC_Abstract_Legacy_Order->__get, wc_doing_it_wrong. This message was added in version 3.0., referer https://.com/wp-admin/plugins.php?plugin_status=all&paged=1&s
The fix just involves changing
$order->id
to$order->get_id()
on line 29 ofcustom-order-statuses-for-woocommerce/ajax/deactivation-form.php
Change:
array_push( $found_orders, $order->id );
to:
array_push( $found_orders, $order->get_id() );
I realise that the developer seems to have disappeared but this code may help others that are concerned about the message in the log file.
- The topic ‘Patch for warning about accessing order ID directly’ is closed to new replies.