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

后端 未结 2 1809
清酒与你
清酒与你 2021-01-05 04:41

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 sh

相关标签:
2条回答
  • 2021-01-05 05:25

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

    0 讨论(0)
  • 2021-01-05 05:30

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

    0 讨论(0)
提交回复
热议问题