product retrieval fails, resulting in a bool instead of a product object
-
Hi dear Dokan support,
I somethimes get the following errors when adding a product to the cart:
[27-Nov-2024 17:26:37 UTC] PHP Warning: Attempt to read property “ID” on bool in …/public_html/wp-content/plugins/dokan-lite/includes/wc-template.php on line 59
[27-Nov-2024 17:26:37 UTC] …/public_html/wp-content/plugins/dokan-lite/templates/global/product-tab.php on line 43
This seems to happen when the product retrieval fails, resulting in abool
instead of a product object.
Could you please ask the developers to add a validation check to ensure the product is correctly retrieved before accessing its properties (e.g., if ($product && is_a($product, ‘WP_Post’)))? This would prevent these warnings and improve reliability.
Thanks for your help!
- You must be logged in to reply to this topic.