提问人:Geoffrey Servant 提问时间:7/2/2023 最后编辑:LoicTheAztecGeoffrey Servant 更新时间:7/2/2023 访问量:312
WooCommerce 严重错误:调用未定义的方法 WC_Product_Simple::get_variation_price()
WooCommerce critical error: Call to undefined method WC_Product_Simple::get_variation_price()
问:
最近,我注意到我的 WooCommerce 网站上出现了一些严重错误。由于出现此问题,因此没有订单。
当我转到 WooCommerce -> Status -> Logs 时,我可以看到特定函数发生的许多错误。
这是堆栈跟踪:
2023-06-01T08:39:58+00:00 严重未捕获的错误:调用 /home/clients/cbade695f2a03ed1b4e40db5c6bc9ad7/web/wp-content/themes/scolax/functions.php:28 中的未定义方法 WC_Product_Simple::get_variation_price()
堆栈跟踪: #0 /home/clients/cbade695f2a03ed1b4e40db5c6bc9ad7/web/wp-includes/class-wp-hook.php(308):wpnuls_text_before_price('<span class=“wo...', Object(WC_Product_Simple))
#1 /home/clients/cbade695f2a03ed1b4e40db5c6bc9ad7/web/wp-includes/plugin.php(205):WP_Hook->apply_filters('<span class=“wo...', 数组)
#2 /home/clients/cbade695f2a03ed1b4e40db5c6bc9ad7/web/wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-product.php(1880):apply_filters('woocommerce_get...', '<span class=“wo...', Object(WC_Product_Simple))
#3 /home/clients/cbade695f2a03ed1b4e40db5c6bc9ad7/web/wp-content/plugins/woocommerce/templates/loop/price.php(25):WC_Product->get_price_html()
#4 /home/clients/cbade695f2a03ed1b4e40db5c6bc9ad7/web/wp-content/plugins/woocommerce/includes/wc-core-functions.php(345):include('/home/clients/c...')
#5 /home/clients/c dans /home/clients/cbade695f2a03ed1b4e40db5c6bc9ad7/web/wp-content/themes/scolax/functions.php à la ligne 28
如果能得到一些帮助,我将不胜感激。谢谢!
答: 暂无答案
评论
get_variation_price()
方法,并且不专门针对变量产品。因此,在其他产品类型上,这会产生严重错误。为避免这种情况,您需要定位“可变”产品类型,如以下代码行所示get_variation_price()