Support » Plugin: WC-AC Hook » Backend log error – status called incorrectly

  • I am seeing some errors in our log that I think relates to this plugin. Can you see what is wrong?

    Backend log: status was called incorrectly. Order properties should not be accessed directly. Backtrace: require(‘wp-blog-header.php’), require_once(‘wp-includes/template-loader.php’), do_action(‘template_redirect’), WP_Hook->do_action, WP_Hook->apply_filters, WC_AJAX::do_wc_ajax, do_action(‘wc_ajax_checkout’), WP_Hook->do_action, WP_Hook->apply_filters, WC_AJAX::checkout, WC_Checkout->process_checkout, WC_Checkout->create_order, do_action(‘woocommerce_checkout_update_order_meta’), WP_Hook->do_action, WP_Hook->apply_filters, WC_AC_Hook->order_created, WC_Abstract_Legacy_Order->__get, wc_doing_it_wrong. This message was added in version 3.0.\n`

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author mtreherne

    (@mtreherne)

    Thanks flexaftale. Does the error message go on to give the line number in the wc-ac-hook.php file?

    The reason I ask is that it has probably been fixed (but not released) yet. Knowing the line number would confirm that for sure.

    The error is a warning and should not cause a fatal error. Nonetheless I have changed the method for accessing order attributes to avoid these messages.

    I suspect the problem you have is at line 96 which is:

    $this->order_status_change ($order_id, null, $order->status);

    and should be:

    $this->order_status_change ($order_id, null, method_exists($order,’get_status’) ? $order->get_status() : $order->status);

    But I need the line number to confirm that.

    Thread Starter flexaftale

    (@flexaftale)

    Hi!

    Thanks for the quick reply. I don’t see the line number in our server logs. I could setup WP debug, if that will work?

    Plugin Author mtreherne

    (@mtreherne)

    Even without the line number I am fairly certain it is line 96. The back trace shows ‘WC_AC_Hook->order_created’ which is the method that line 96 falls in.

    The bug will be fixed when I release the next version of the plug in. I will do that at some point this year but apart from this bug I don’t have anything to release at the moment. I’m reluctant to make everyone install a new version today just to fix a warning message.

    So you have 3 options really:

    1) Wait for next version of the plugin. Depending on your technical skills you may want to consider options 2 or 3.

    2) Change the line yourself in advance of the next release:

    Replace line 96 in wc-ac-hook.php from

    $this->order_status_change ($order_id, null, $order->status);

    to

    $this->order_status_change ($order_id, null, method_exists($order,’get_status’) ? $order->get_status() : $order->status);

    3) I can release a development branch of wc-ac-hook so that you can copy and replace the whole wc-ac-hook.php file if you don’t want to edit the line.

    Thread Starter flexaftale

    (@flexaftale)

    Great, I will change line 96 and get back to you, if it does not fix the error. Thank you very much for your quick replies!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Backend log error – status called incorrectly’ is closed to new replies.