Wordpress 更改带有标签的产品在商店和单一产品页面上显示的价格

Wordpress 更改带有标签的产品在商店和单一产品页面上显示的价格,wordpress,woocommerce,Wordpress,Woocommerce,理想情况下,对所有具有给定标签的产品和变体应用20%的折扣,然后将其正确显示 现在我有一个控制实际价格的插件,我正试图改变价格的视觉显示方式 我已经想出了这个局部解决方案来改变商店和单一产品页面中显示的价格 2019-11-21T22:45:39+00:00 CRITICAL Uncaught Error: Call to a member function is_type() on null in */public_html/wp-content/themes/child/functions.

理想情况下,对所有具有给定标签的产品和变体应用20%的折扣,然后将其正确显示

现在我有一个控制实际价格的插件,我正试图改变价格的视觉显示方式

我已经想出了这个局部解决方案来改变商店和单一产品页面中显示的价格

2019-11-21T22:45:39+00:00 CRITICAL Uncaught Error: Call to a member function is_type() on null in */public_html/wp-content/themes/child/functions.php:325
Stack trace:
#0 */public_html/wp-includes/class-wp-hook.php(288): price_sale_comforter('<span class="wo...')
#1 */public_html/wp-includes/plugin.php(208): WP_Hook->apply_filters('<span class="wo...', Array)
#2 */public_html/wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-product.php(1750): apply_filters('woocommerce_get...', '<span class="wo...', Object(WC_Product_Variation))
#6 */public_html/wp-content/themes/child/functions.php on line 325
有人能清理一下吗?它抛出了致命的错误,但却达到了预期的效果。。。。希望在“商店和单一产品”页面上更改带有给定标签的产品的显示价格

2019-11-21T22:45:39+00:00 CRITICAL Uncaught Error: Call to a member function is_type() on null in */public_html/wp-content/themes/child/functions.php:325
Stack trace:
#0 */public_html/wp-includes/class-wp-hook.php(288): price_sale_comforter('<span class="wo...')
#1 */public_html/wp-includes/plugin.php(208): WP_Hook->apply_filters('<span class="wo...', Array)
#2 */public_html/wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-product.php(1750): apply_filters('woocommerce_get...', '<span class="wo...', Object(WC_Product_Variation))
#6 */public_html/wp-content/themes/child/functions.php on line 325
2019-11-21T22:45:39+00:00严重未捕获错误:在*/public\u html/wp content/themes/child/functions中,对成员函数的调用为空的类型()。php:325
堆栈跟踪:

#0*/public_html/wp includes/class wp hook.php(288):price_sale_compter(“我不能在这里测试代码,但我要从一个简单的

if(为空($product))返回$price;

在这一行之后:


global$product;

您正在提供堆栈跟踪,但是否也有错误?@snowerd是的,有一个错误,stackoverflow格式将其删除,错误在post now中可见感谢@snowerd阻止了流血,没有更多错误。只是,现在在发送的一些电子邮件中,它仍然显示原始价格,但我很抱歉我认为这是个独立的问题,干杯!