PHP Warning on Product Retrieval in dokan-lite/includes/wc-template.php and dokan-lite/templates/global/product-tab.php #2455
Fayeakuzzamantonmoy
started this conversation in
Bug / Problem
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description:
The client has reported encountering the following PHP warning when attempting to add a product to the cart in WordPress.org platform:
Issue Summary:
This warning is triggered when the product retrieval fails, resulting in a boolean value (
false
) instead of aWP_Post
object. The warning occurs because the code attempts to access theID
property on a boolean value.Suggested Fix:
We need to add a validation check to ensure that the product object is correctly retrieved before accessing its properties.
Files Affected:
dokan-lite/includes/wc-template.php
(Line 59)dokan-lite/templates/global/product-tab.php
(Line 43)Expected Outcome:
Adding a proper validation check before accessing product properties should prevent this warning from occurring, improving the stability and reliability of the plugin.
Topic Link:
https://wordpress.org/support/topic/product-retrieval-fails-resulting-in-a-bool-instead-of-a-product-object/
Beta Was this translation helpful? Give feedback.
All reactions