Closed MaxBaumR1 closed 2 years ago
Hey @MaxBaumR1,
thank you for your feedback! Yes, you are right wc_get_product()
can return null
or false
in case no product has been found. I'll add condition to check what type is $child
variable.
Please also check your database if array of children ids for parent product is valid because probably it's not up to date.
If you have any further questions please don't hesitate to contact me/us at anytime.
All the best, Patryk
Hey @MaxBaumR1, I added check for WC_Product instance, fix should be included in next connector release bugfix/CO-1887_check_for_product_instance
We tried to import our products into the JTL Wawi but it failed with the error message:
global.ERROR: Exception 'Error' (Code: 0) with message 'Call to a member function is_purchasable() on bool' in [DOCUMENT_ROOT]/wp-content/plugins/woo-jtl-connector/src/Controllers/Product/ProductVaSpeAttrHandler.php:399 [] []
The problem is here: ... foreach ($product->get_children() as $childId) { $child = \wc_get_product($childId); $isPurchasable = $isPurchasable & $child->is_purchasable(); } ...
"wc_get_product()" can return null or false which is not validated.