Lud*_*udo 4 php wordpress product variations woocommerce
自从我们升级到Woocommerce第3版以来,我们的订单确认显示了包含变化细节的大量标题.我不喜欢它看起来如何,它打破了一些定制插件的一些重要功能.
有一个过滤器可用于禁用在woocommerce_product_variation_title_include_attribute_name
我所理解的标题中显示的数据.但我不知道在哪里应用过滤器.
是否有一种快速的方法来应用过滤器将其更改为显示为之前的显示?
Loi*_*tec 13
此过滤器应该以这种方式返回filter hook中第一个参数的false
值:$should_include_attributes
woocommerce_product_variation_title_include_attributes
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;
}
Run Code Online (Sandbox Code Playgroud)
代码放在活动子主题(或主题)的function.php文件中,或者放在任何插件文件中.
它应该像你期望的那样工作.
更新:更短的方式是:
add_filter( 'woocommerce_product_variation_title_include_attributes', '__return_false' );
Run Code Online (Sandbox Code Playgroud)
代码放在活动子主题(或主题)的function.php文件中,或者放在任何插件文件中.
只是工作.
归档时间: |
|
查看次数: |
3561 次 |
最近记录: |