How to add SVG icon above product tab title

I used the following code to create custom product tabs (woocommerce), and now I was wondering if I can add an SVG icon above the tab title.

My code for a custom product tab:

add_filter( 'woocommerce_product_tabs', 'misha_custom_tab' );

function misha_custom_tab( $tabs ) {

    $tabs['misha_custom_tab'] = array(
        'title'    => 'MyTabTitle',
        'callback' => 'misha_custom_tab_content', // the function name, which is on line 15
        'priority' => 50,
    );

    return $tabs;

}

function misha_custom_tab_content( $slug, $tab ) {

    echo '<h2>' . $tab['title'] . '</h2><p>Tab Content. You can display something in PHP here as well.</p>';

}

Image Examples:

Before:
before

After:
enter image description here

How can I add an SVG icon above the product tab title?

0

Leave a Comment