问题描述
自从我们升级到Woocommerce版本3以来,我们的订单确认书都显示了巨大的标题,其中包括变化的详细信息.我不喜欢它的外观,它破坏了某些定制插件中的一些重要功能.
Ever since we upgraded to Woocommerce version 3 our order confirmations are showing huge titles that include the variation detail. I don't like how it looks and it breaks some important functionalities in some custom-made plugins.
据我所知,有一个过滤器可用于禁用显示在名为 woocommerce_product_variation_title_include_attribute_name
的标题中的数据.但是我不知道在哪里应用过滤器.
There is a filter that can be used to disable this data displaying in the title called woocommerce_product_variation_title_include_attribute_name
from what I understand. But I have no idea where to apply the filter.
有没有一种快速的方法来应用过滤器,使其像以前一样变回显示?
Is there a quick way to apply the filter to change it back to display as it did before?
推荐答案
此过滤器应该可以工作,返回false第一个参数的false
值/blob/master/includes/data-stores/class-wc-product-variation-data-store-cpt.php#L243"rel =" noreferrer> woocommerce_product_variation_title_include_attributes
过滤器用这种方式钩住:
This filter should work returning a false
value for $should_include_attributes
first argument in woocommerce_product_variation_title_include_attributes
filter hook this way:
add_filter( 'woocommerce_product_variation_title_include_attributes', 'custom_product_variation_title', 10, 2 );
function custom_product_variation_title($should_include_attributes, $product){
$should_include_attributes = false;
return $should_include_attributes;
}
代码会出现在您活动的子主题(或主题)的function.php文件或任何插件文件中.
它应该可以按预期工作.
It should just work as you expect.
更新:较短的方法是:
add_filter( 'woocommerce_product_variation_title_include_attributes', '__return_false' );
代码会出现在您活动的子主题(或主题)的function.php文件或任何插件文件中.
也可以.
这篇关于在WooCommerce 3+中隐藏购物车项目标题中的变化信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!