gpt4 book ai didi

php - 在 WooCommerce 3+ 中隐藏购物车商品标题的变体信息

转载 作者:塔克拉玛干 更新时间:2023-11-03 05:57:29 26 4
gpt4 key购买 nike

自从我们升级到 Woocommerce 第 3 版以来,我们的订单确认显示了包含变体详细信息的巨大标题。我不喜欢它的外观,它破坏了一些定制插件中的一些重要功能。

引用:Order Name Showing Variations since update to WC version 3

根据我的理解,有一个过滤器可用于禁用名为 woocommerce_product_variation_title_include_attribute_name 的标题中显示的数据。但我不知道在哪里应用过滤器。

有没有一种快速的方法来应用过滤器以将其改回显示之前的状态?

最佳答案

此过滤器应该可以为 $should_include_attributes 中的第一个参数返回一个 falsewoocommerce_product_variation_title_include_attributes以这种方式过滤 Hook :

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 文件中或任何插件文件中。

它应该会如您所愿地工作。


更新:较短的方法是:

add_filter( 'woocommerce_product_variation_title_include_attributes', '__return_false' );

代码位于您的事件子主题(或主题)的 function.php 文件中或任何插件文件中。

也很管用。

关于php - 在 WooCommerce 3+ 中隐藏购物车商品标题的变体信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44839975/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com