Support » Plugin: Portugal CTT Tracking for WooCommerce » Fatal Error on order backend

  • Resolved carinalves

    (@carinalves)


    Hi,
    I’m trying to use your plugin on my online store, but it looks like it’s not compatible with the most recent versions of wordpress/woocommerce, as I’m getting this error in the order backend page and cannot insert the tracking codes at all:

    Fatal error: Uncaught Error: Call to a member function get_meta() on bool in /home/customer/www/.../public_html/wp-content/plugins/portugal-ctt-tracking-woocommerce/includes/class-ctt-tracking.php:126 Stack trace: #0 /home/customer/www/.../public_html/wp-admin/includes/template.php(1395): CTT_Tracking->shop_order_add_meta_boxes_html(Object(WP_Post), Array) #1 /home/customer/www/.../public_html/wp-admin/edit-form-advanced.php(688): do_meta_boxes(Object(WP_Screen), 'normal', Object(WP_Post)) #2 /home/customer/www/.../public_html/wp-admin/post.php(206): require('/home/customer/...') #3 {main} thrown in /home/customer/www/.../public_html/wp-content/plugins/portugal-ctt-tracking-woocommerce/includes/class-ctt-tracking.php on line 126

    This error shows instead of the usual field to insert the code.

    Could you please take a look and check if there’s anything that can be done about this? It is working really well on a different store I manage – which I have yet to update.

    Thanks in advance!

    • This topic was modified 5 months, 2 weeks ago by carinalves.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Marco Almeida

    (@webdados)

    Hi,

    We’re using the latest versions (even betas and RC) of WooCommerce and WordPress on our development environment all the time, add we can’t replicate the error.

    What happens on line 126 is that we try to get a met from the order, and before that, we got the order id from the $post object that should be available on the order edit screen:

    function shop_order_add_meta_boxes_html() {
    		global $post;
    		$order_object      = wc_get_order( $post->ID );
    		$ctt_tracking_code = $order_object->get_meta( '_ctt_tracking_code' );
    

    I suspect some other plugin is messing up with the $post global before we try to access it.

    Please disable all your other plugins and use Storefront as a theme. Then check if it works. Then re-activate your theme again and the other plugins one by one until you find which one is causing the issue.

    Thread Starter carinalves

    (@carinalves)

    Hi,

    Oh, that was probably it. I didn’t get to debug the issue, as I’ve immediately updated the plugin and now it’s working perfectly! Thank you so much for your helpfulness!

    5 stars support indeed 🙂

    Thanks again!

    Plugin Author Marco Almeida

    (@webdados)

    We issued a new release today that changes the way we get the order and it’s more fail proof. Anyway, you still may have some plugin messing up with the global $post variable which can have other side effects.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.