Uncaught Error: Call to a member function get_name() on bool
-
Hi,
since the last update of the (payed) Security Audit Log plugin, I am getting this exception from WooCommerce Subscription when a renewal order is processed:
04-07-2022 @ 15:49:49 - scheduled action 341454 (subscription payment) failed to finish processing due to the following error: Uncaught Error: Call to a member function get_name() on bool in /opt/wordpress/wp-content/plugins/wp-activity-log-for-woocommerce/wp-security-audit-log/custom-sensors/WSAL_Sensors_WooCommerce.php:3053 Stack trace: #0 /opt/wordpress/wp-includes/class-wp-hook.php(307): WSAL_Sensors_WooCommerce->event_order_items_added(538, Object(WC_Order_Item_Product), 6689) #1 /opt/wordpress/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array) #2 /opt/wordpress/wp-includes/plugin.php(474): WP_Hook->do_action(Array) #3 /opt/wordpress/wp-content/plugins/woocommerce/includes/wc-order-item-functions.php(39): do_action('woocommerce_new...', 538, Object(WC_Order_Item_Product), 6689) #4 /opt/wordpress/wp-content/plugins/woocommerce-subscriptions/vendor/woocommerce/subscriptions-core/includes/wcs-order-functions.php(256): wc_add_order_item(6689, Array) #5 /opt/wordpress/wp-content/plugins/woocommerce-subscriptions/vendor/woocommerce/subscriptions-core/includes/wcs-renewal-functions.php(29): wcs_create_order_from_su 04-07-2022 @ 15:49:49 - action args: subscription_id: 6165
$item->get_product()
can return false in case the product does not exist anymore (in my case, I suspect that this is when a discount is processed that is added to the subscription).This case is however not handled in your code. I added an “if ($product === false)…” handling to the code manually now so that my site keeps working.
Would be great to have a fix for this.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Uncaught Error: Call to a member function get_name() on bool’ is closed to new replies.