且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Woocommerce 单品页面中的重命名描述选项卡

更新时间:2023-02-02 13:11:32

你忘记了过滤钩子:

add_filter( 'woocommerce_product_tabs', 'woo_customize_tabs', 100, 1 );
function woo_customize_tabs( $tabs ) {

    unset($tabs['reviews']);    // Remove the reviews tab

    $tabs['description']['title'] = __( 'More Information' ); // Rename the description tab

    return $tabs;
}

代码进入您的活动子主题(或主题)的 function.php 文件或任何插件文件中.

所有代码都在 Woocommerce 3+ 上进行了测试并且可以运行.

All code is tested on Woocommerce 3+ and works.

更新(与您的评论相关) |重命名产品描述标题(在标签内):

Update (related to your comment) | Rename product description heading (inside the tab):

要重命名描述标题,请以这种方式使用 woocommerce_product_description_heading 过滤钩子:

To rename description heading use woocommerce_product_description_heading filter hook this way:

add_filter( 'woocommerce_product_description_heading', 'rename_product_description_heading', 10, 1 );
function rename_product_description_heading( $heading ) {
    return  __( 'Additional Information', 'woocommerce' );
}

代码进入您的活动子主题(或主题)的 function.php 文件或任何插件文件中.

所有代码都在 Woocommerce 3+ 上进行了测试并且可以运行.

All code is tested on Woocommerce 3+ and works.

官方相关文档:编辑产品数据标签