PHP WordPress WooCommerce

WooCommerce - Adding & Changing Product Tabs

347 days ago

The code below allows you to add custom tabs for your product detail pages.

<?php

add_filter( 'woocommerce_product_tabs', 'hoog_custom_product_tabs' );

/**
* Changing tabs for Single Product
*/
function hoog_custom_product_tabs( $tabs ) {

    // Remove (unset) the additional info tab
    unset( $tabs['additional_information'] );


    // Adding new tab
    $tabs['downloads'] = array(
        'title'     => __( 'Downloads', 'woocommerce' ),
        'priority'  => 100,
        'callback'  => 'woo_downloads_tab_content'
    );

    return $tabs;

}

/**
* Downloads tab content output
*/
function woo_downloads_tab_content() {
    echo '<h2>Downloads</h2>';
}
Dylan Hoogeveen Dylan Hoogeveen