• Resolved mk2mark

    (@mk2mark)


    Hi,

    We’ve been getting fatal errors on our site centered around events and tickets for them. I haven’t been able to establish a cause. From what I can see it happens at various places for various reasons.

    I’ve also previously had the fatal error when hitting the “checkout now” button on the ticket popup.

    I’m hoping this is something you’ve seen before because it seems pretty random.

    Here’s the error.

    [28-Jan-2021 21:17:57 UTC] PHP Fatal error: Uncaught Error: Call to a member function get_items() on bool in /www/wp-content/plugins/woocommerce/includes/class-wc-order.php:1902
    Stack trace:
    #0 /www/wp-content/plugins/event-tickets-plus/src/Tribe/Commerce/WooCommerce/Orders/Refunded.php(101): WC_Order->get_item_count_refunded()
    #1 /www/wp-content/plugins/event-tickets-plus/src/Tribe/Commerce/WooCommerce/Orders/Refunded.php(50): Tribe__Tickets_Plus__Commerce__WooCommerce__Orders__Refunded->real_get_count(1023)
    #2 /www/wp-content/plugins/event-tickets-plus/src/Tribe/Commerce/WooCommerce/Main.php(2963): Tribe__Tickets_Plus__Commerce__WooCommerce__Orders__Refunded->get_count(1023)
    #3 /www/wp-content/plugins/event-tickets-plus/src/Tribe/Commerce/WooCommerce/Main.php(1814): Tribe__Tickets_Plus__Commerce__WooCommerce__Main->get_refunded(1023)
    #4 /www/wp-content/plugins/event-tickets-plus/src/views/v2/attendee-registration/mini-cart.php(67): Tribe__Tickets_Plus__Commerce__WooCommerce__Main->get_ticket(848, 1023)
    #5 /www/wp-content/plugins/event-tickets/common/ in /www/wp-content/plugins/woocommerce/includes/class-wc-order.php on line 1902

Viewing 3 replies - 1 through 3 (of 3 total)
  • There’s an issue with WooCommerce when working with certain plugins/integrations. This appears to be the result of wc_get_order() returning false and then WooCommerce calling methods off of the assumed order objects. But because it’s a false value, calling the object method triggers this error.

    See here for the fix that will be released as part of WooCommerce 5.1 (note: this will not be in WooCommerce 5.0 coming out soon):
    https://github.com/woocommerce/woocommerce/pull/28927

    Here’s a workaround you can use in the meantime to remove invalid orders from the list of orders it retrieves:
    https://gist.github.com/sc0ttkclark/e130fd67b950a40e96638a4fffd1aaef

    I haven’t been able to determine which plugin(s) cause this problem, but the workaround above solves the problem completely. Even after the fix is in place with WooCommerce 5.1, keeping the code in place will not cause adverse effects so you have time to remove it at your leisure at that point.

    Thread Starter mk2mark

    (@mk2mark)

    Sure enough, that looks like it fixed it.

    Thanks a ton!!

    Glad this helped you, I’ll be putting this workaround into Event Tickets Plus in the upcoming release where we’ll keep it there until well after WooCommerce 5.1 is out to give everyone a chance to avoid this particular issue.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Getting a fatal error on some pages’ is closed to new replies.