Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 842
Rameez Iqbal Avatar asked Apr 12 '17 15:04

Rameez Iqbal


1 Answers

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();

like image 148
rafawhs Avatar answered Oct 22 '22 03:10

rafawhs