Hi Nuera,
I just check your setup and found out why they are not showing the specific subcategory of the main category. The main problem here is that the code you added in your child theme functions.php.
add_filter('cs_looper_custom_subcat', function($result, $args)
{
$term_id = cs_dynamic_content( $args['parent_cat'] );
$cat_args = array(
'hide_empty' => 1,
'child_of'=> $term_id,
'taxonomy' => 'product_cat',
);
$subcats = get_categories($cat_args);
return $subcats;
}, 10, 2);
The $term_id on that code is empty that’s why it is showing all the categories and subcategories. To fix your issue, please update your code to this one.
add_filter('cs_looper_custom_subcat', function($result, $args)
{
$category = get_queried_object();
$cat_args = array(
'hide_empty' => 1,
'child_of'=> $category->term_id,
'taxonomy' => 'product_cat',
);
$subcats = get_categories($cat_args);
return $subcats;
}, 10, 2);
That code will do the trick. It will display the sub-category of the specific main category.
Hope that helps.
Thank you.