woocommerce 通知 product_type 被错误调用.不应直接访问产品属性 [英] woocommerce notice product_type was called incorrectly . Product properties should not be accessed directly

查看:72
本文介绍了woocommerce 通知 product_type 被错误调用.不应直接访问产品属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在将 WooCommerce 版本更新到 3.0 后,我在商店页面上的所有产品中都收到了此通知.

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

注意:product_type 被调用错误地.不应直接访问产品属性.有关更多信息,请参阅在 WordPress 中调试.(此消息是在 3.0 版中添加的.)在 C:\xampp\htdocs\oye\wp-includes\functions.php 上的第 4137 行

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

知道如何修复它吗?

推荐答案

不推荐使用 product_type 属性.使用 get_type() 获取内部类型.

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

所以你需要改变这个:

$product->product_type;

为此:

$product->get_type();

这篇关于woocommerce 通知 product_type 被错误调用.不应直接访问产品属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆