WooCommerce Webhooks not firing because of error in wp-includes/meta.php


I’m trying to implement a WooCommerce Webhook that fires when an order was updated to tell another system that it needs to generate a file based on the payload provided via the webhook. For getting to know what is actually sent and in which cases I’ve created a new WebHook that is sending to a RequestBin:

Webhook Configuration

Status: Active
Topic: Order updated
Delivery URL: a RequestBin URL
Secret: somesecret
API version: WP Rest API Integration v3

I’ve noticed that nothing was sent and WordPress was logging the error shown below:

error message in debug.log

PHP Notice:  Trying to access array offset on value of type bool in .../woocommerce/wp-includes/meta.php on line 582


580 if ( ! $meta_cache ) {
581     $meta_cache = update_meta_cache( $meta_type, array( $object_id ) );
582     $meta_cache = $meta_cache[ $object_id ];
583 }

I’ve nailed down the issue further and it has shown that update_meta_cache() in line 581 is sometimes returning false and, as a result, $meta_cache is not an array but a boolean. This case can happen only if $object_ids or $meta_type is empty/null or _get_meta_table() inside update_meta_cache() returns null. Unfortunately, a webhooks-delivery log file is not created by WooCommerce.

Am I doing something wrong, is proper error handling missing in line 582 or is it just a configuration issue or bug?

Thanks in advance.

, Johannes 4 years 2020-03-24T20:51:25-05:00 0 Answers 164 views 0

Leave an answer