Got error ‘PHP message: id was called incorrectly. Order properties should not
-
Good morning, a while ago I wrote a post saying that since I updated to WooCommerce 8.1.1 the backend of my store is very slow. I have to say that the visual theme is created from a custom template that had not been maintained for more than three years. The issue is that the website was very, very slow for me when trying to access the products and when accessing the orders, especially when it comes to searching for an order. The hosting told me to eliminate this function, since the error occurred hundreds of times:
//
/* Remove action cancel unpaid orders / /*/
add_action(‘init’,’remove_woocommerce_process_registration’);function remove_woocommerce_process_registration() {
error_log('Eliminamos llamada a wc_cancel_unpaid_orders() - '); remove_action('woocommerce_cancel_unpaid_orders', 'wc_cancel_unpaid_orders');
}
By removingthe function I discovered that when trying to access products from the back, this error occurs:
AH01071: Got error ‘PHP message: id was called incorrectly. Order properties should not be accessed directly. Backtrace: require(‘wp-blog-header.php’), wp, WP->main, WP->parse_request, do_action_ref_array(‘parse_request’), WP_Hook->do_action, WP_Hook->apply_filters, rest_api_loaded, WP_REST_Server->serve_request, WP_REST_Server->dispatch, WP_REST_Server->respond_to_request, WC_REST_CRUD_Controller->get_items, WC_REST_Orders_V2_Controller->prepare_object_for_response, Automattic\\WooCommerce\\Admin\\API\\Orders->get_formatted_item_data, Automattic\\WooCommerce\\Admin\\Overrides\\Order->get_data_without_line_items, WC_Order->get_order_number, apply_filters(‘woocommerce_order_number’), WP_Hook->apply_filters, WC_Seq_Order_Number_Pro->get_order_number, WC_Abstract_Legacy_Order->__get, wc_doing_it_wrong. This message was added in version 3.0.’, referer: https://negrillo.es/wp-admin/edit.php?post_status=wc-on-hold&post_type=shop_order
The times I have tried to change the way the id is called (to $product->get_id()), but then the errors are bigger and affect the database.
I have to say that at the moment only the back was slow, but if I try to change the calls to the id, the front is also slow.
Has anyone had the same problem?
Thank you 🙂
- El debate ‘Got error ‘PHP message: id was called incorrectly. Order properties should not’ está cerrado a nuevas respuestas.