<?php
/**
 * The sidebar containing the main widget area
 *
 * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
 *
 * @package Better_Morning
 */
?>
  <?php 
		global $post;
		$terms = get_the_terms( $post->ID, 'product_category' );
		$categorys = get_terms(array( 
		'taxonomy' => 'product_category',
		'parent'   => 0
		) );
  ?>
                    <ul class="accordion"  id="accordion-5">
                    	<?php foreach ($categorys as $category) { ?>
                        <li><a href="<?php echo get_term_link($category->term_id);?>"><?php echo $category->name;?></a>
                            <ul class="sub-list">
                            	<?php 
									$second_terms = get_terms(array( 
									'taxonomy' => 'product_category',
									'hide_empty'=>false,
									'parent'   => $category->term_id,
									) );
									foreach ($second_terms as $second_term) {
								?>
                                <li class="active"  >
                                	<a href="<?php echo get_term_link($second_term->term_id);?>" class="sub-list_form"><?php echo $second_term->name;?></a>

</li>
                                <?php } ?>
                             </ul>
                        </li>
                        <?php } ?>
                    </ul>