Get Third Level Kategorien WooCommerce

Ich versuche, WooCommerce-Kategorien der dritten Ebene zu bekommen. Hier folgt mein Quellcode:

$args = array( 'hierarchical' => 1, 'show_option_none' => '', 'hide_empty' => 0, 'parent' =>18, 'taxonomy' => 'product_cat' ); $subcats = get_categories($args); echo '
'; foreach ($subcats as $sc) { $link = get_term_link($sc->slug, $sc->taxonomy); echo '
    ' . $sc->name . ''; $args2 = get_term(array( 'hierarchical' => 0, 'hide_empty' => false, // 'taxonomy' => 'product_cat' )); $subsubCats = get_categories($agrs2); foreach ($subsubCats as $subsubCats) { $SubLinks = get_term_link($subsubCats->slug, $subsubCats- >taxonomy); echo '
  • sub -' . $subsubCats->name .'
  • '; } echo '
'; } echo '
'; wp_reset_query();

Solutions Collecting From Web of "Get Third Level Kategorien WooCommerce"

Ich triggerse es durch mein Selbst

  $args = array( 'hierarchical' => 1, 'show_option_none' => '', 'hide_empty' => 0, 'parent' => $number = 16, 'taxonomy' => 'product_cat' ); $subcats = get_categories($args); echo '
'; foreach ($subcats as $sc) { $link = get_term_link($sc->slug, $sc->taxonomy); echo '
    ' . $sc->name . ''.$sc->term_id; $args2 = get_terms('product_cat',array( 'child_of' => $sc->term_id, 'hierarchical' => 1, 'hide_empty' => 1, )); foreach ($args2 as $subsubCats) { $SubLinks = get_term_link($subsubCats->slug, $subsubCats->taxonomy); echo '
  • sub - ' . $subsubCats->name . '
  • '; } echo '
'; } echo '
'; wp_reset_query();