N
N
nat292021-06-03 10:28:53
WordPress
nat29, 2021-06-03 10:28:53

How to make the tabs in the Woo product card displayed depending on the category?

There is a code with which we add tabs to the product card on woocommerce.
There he is:

add_filter( 'woocommerce_product_tabs', 'truemisha3_new_product_tab', 26 );
 
function truemisha3_new_product_tab( $tabs ) {
 
  $tabs[ 'new_vonros_tab' ] = array(
    'title' 	=> 'Вопрос',
    'priority' 	=> 26,
    'callback' 	=> 'truemisha3_new_tab_content'
  );
 
  return $tabs;
 
}
function truemisha3_new_tab_content() {
 
  echo '<p>Тест-тест</p>';
 
}

How to add code so that different tabs are displayed on products, depending on which category they are in? There are 2 parent categories on the site, one tab for one category, the other for another.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question