• Resolved arumugamact

    (@arumugamact)


    I want to hide Q&A tab in product detailed page if data not configured
    Is there any hook available ?

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hii @arumugamact,

    There is no direct hook in this case, but you have add following snippet on your child theme or snippet plugin to hide Q&A tab.

    function custom_body_classes($classes) {
    	if (is_product()) { 
        	$product = wc_get_product();
    		$productId = $product->get_id();
            $all_questions = get_post_meta($productId, 'ets_question_answer', true);
            if (empty($all_questions)) {
                $classes[] = 'remove_qa_tab';
            }
        }
        return $classes;
    }
    
    add_filter('body_class', 'custom_body_classes',999);

    Dear @arumugamact,

    If you can’t do the CSS, here is the complete snippet with CSS which will hide the tab.

    function custom_body_classes($classes) {
        if (is_product()) { 
            $product = wc_get_product();
            $productId = $product->get_id();
            $all_questions = get_post_meta($productId, 'ets_question_answer', true);
            if (empty($all_questions)) {
                $classes[] = 'remove_qa_tab';
            }
        }
        return $classes;
    }
    
    add_filter('body_class', 'custom_body_classes');
    
    function add_custom_css_to_head() {
        echo '<style>
            body.remove_qa_tab .tabs .ask_tab {
                display: none;
            }
        </style>';
    }
    
    add_action('wp_head', 'add_custom_css_to_head');
    
    Plugin Contributor Sunny Soni

    (@sunnysoni)

    Dear @arumugamact ,

    I am reaching out to inform you that I will be closing this topic now due to inactivity.

    As we have not received any response or update from you for more than 2 months, we assume that the topic has been resolved or is no longer a concern.

    If you have any further questions or concerns, please do not hesitate to create a new topic. We would be happy to assist you further.

    Thank you for bringing this to our attention, and we appreciate your interest in our WordPress plugin.

    Best Regards,
    Sunny

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Hide Q&A tab if data not found’ is closed to new replies.