fatal PHP error
-
Hello,
I am experiencing a fatal PHP error caused by the plugin ACO Product Labels for WooCommerce.
Error details:
Uncaught Error: Call to a member function get_ID() on null
File: /includes/class-acoplw-badge.php
Line: 144
This happens when the badge is rendered outside of a standard WooCommerce product context (for example inside Porto / Elementor posts grid or during REST API calls). In these cases, the $product object is null, but the plugin still calls $product->get_ID() without checking if the product exists.
Stack trace clearly shows the badge being triggered via acoplwBadgeHook in non-product contexts.
It looks like a missing safety check before calling get_ID(). A simple guard such as:
if ( ! is_object( $product ) || ! method_exists( $product, 'get_ID' ) ) {
return '';
}
would prevent the fatal error.
At the moment the only workaround is disabling the plugin or limiting the badge usage, otherwise the site crashes.
Could you please confirm if this is a known issue and if a fix is planned?
Thank you for your support.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
You must be logged in to reply to this topic.