Filter for product subcategory listing page load

Do this code on category-archive template.

  1. Fetch queried object using get_queried_object().
  2. Check if the parent value in returned object is 0 or not.
  3. If it is not 0 then run your code.

    $category = get_queried_object();
    if($category->parent != 0){
         //write your code here
    }