woocommerce notice product_type was called incorrectly . Product properties should not be accessed directly

拈花ヽ惹草 提交于 2019-12-04 01:38:29

问题


I'm having this notice with all products on shop page after updating WooCommerce version to 3.0.

Notice: product_type was called incorrectly . Product properties should not be accessed directly. Please see Debugging in WordPress for more information. (This message was added in version 3.0.) in C:\xampp\htdocs\oye\wp-includes\functions.php on line 4137

any idea how to fix it?


回答1:


The product_type property is deprecated. Use get_type() to get internal type.

So you need to change this:

$product->product_type;

to this:

$product->get_type();




回答2:


(in functions.php) tried editing the "Select Options" text in WooCommerce and it gave that error.

Rafawhs answer worked for me too. This: $product->get_type();



来源:https://stackoverflow.com/questions/43374133/woocommerce-notice-product-type-was-called-incorrectly-product-properties-shou

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!