Remove Description tab if empty in woocommerce – codeforall

Below for line code can do magic if you want to remove the description tab from woocommerce single product page

just add this code to your tabs.php
themes/your-theme-name/woocommerce/single-product/tabs/tabs.php

<?php

        $product_detail = get_post(get_the_ID())->post_content;

        if(strlen($product_detail)==0)

        {

            $description = 0;

            unset($tabs["description"]);

        }

    ?>

copy and paste the above code in tabs.php file just above where it starts


Leave a Reply

Your email address will not be published.