• 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 🙂

Viendo 3 respuestas - de la 1 a la 3 (de un total de 3)
  • Moderador almendron

    (@almendron)

    This forum is in Spanish. The English forum:

    https://wordpress.org/support/forums/

    Iniciador del debate cberzosabc

    (@cberzosabc)

    Ah, si yo hablo español, pero me confundí de foro. Lo que quiero decir es que hace unas semanas actualicé WooCommerce a la versión 8.1.1 y desde entonces el backend funciona muy lento. Acceder a los productos de la tienda o a los pedidos me dejan tiempos de espera de unos 40 segundos, sobretodo si intento buscar un pedido. Hablé con la asistencia de mis proveedores de hosting, ya que hace años ocurrió lo mismo y solo se solucionó al cambiar de hosting, pero ellos me dijeron que tiene más que ver con esta función de mi tema personalizado, que saltaba cientos de veces:

    //
    /* 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');

    }

    Al eliminar la función he descubierto que al intentar acceder a los productos desde el back, ocurre este error:

    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

    He cambiado la llamada al error ( a $product->get_id()), pero los errores son mayores y afectan a la base de datos.

    Hasta el momento el error solo era que que el back iba lento, pero cuando intenté hacer los cambios, el front también va muy lento. ¿Alguien sabe a qué puede deberse?

    Gracias 🙂

    Moderador almendron

    (@almendron)

    Prueba con

    global $product;
    $id = $product->get_id();

    Y luego la variable «$id» la usas en la función.

Viendo 3 respuestas - de la 1 a la 3 (de un total de 3)
  • El debate ‘Got error ‘PHP message: id was called incorrectly. Order properties should not’ está cerrado a nuevas respuestas.