cancel
Showing results for 
Search instead for 
Did you mean: 

Remove custom tab from product page

Remove custom tab from product page

I want to remove custom tab based on if their data has no value in the admin section. Example: Suppose I create a tab for product attribute "reference" and for some product it has no value then tab will not be shown on frontend product page.

2 REPLIES 2

Re: Remove custom tab from product page

Hello @rose901yopecd7 ,

Please refer below link I hope this will work for you.

https://magento.stackexchange.com/questions/261791/how-to-remove-products-tab-when-it-has-no-value-i...

If it helps you, please accept it as solution and give kudos.

Regards.

Re: Remove custom tab from product page

@rose901yopecd7 You can just apply the if condition from where you are rendering the data.

 

Show only if it contains data like below code.

 

            $attrVal = $product->getData('test'); //Value of your reference Attribute
            if(!isset($attrVal) || trim($attrVal) === ''){
                //show the value
            }

Thanks