How can I merge the Description and Additional Information tabs in WooCommerce?

前端 未结 3 449
忘掉有多难
忘掉有多难 2020-12-18 15:02

I am trying to merge the additional information tab with the description tab in WooCommerce.

The intention is to display information from both tabs side-by-side in a

3条回答
  •  误落风尘
    2020-12-18 15:47

    I ended up taking a slightly different approach, basically just disabled the Additional Details tab and re-adding the content to the_content of the product (that is, the normal Description tab).

    // Remove Additional Info tab
    add_filter('woocommerce_product_tabs', 'remove_tab_additional_info', 30);
    function remove_tab_additional_info($tabs){
        unset( $tabs['additional_information'] );
        return $tabs;
    }
    
    // Add original Additional Info tab info to the end of the_content
    add_filter('the_content','add_details_to_content', 10, 1);
    function add_details_to_content($content){
        if ( is_product() ){
            global $product;
            $content = '
    '.$content.'
    '; ob_start(); ?>

提交回复
热议问题