Need some help with tweaking a code for woocommerce [closed]
try this $term = get_term_by( ‘slug’, get_query_var( ‘term’ ), get_query_var( ‘taxonomy’ ) ); // current term $parent_slug = ”; // default slug param if( $term->parent ){ // if current term has parent then get it’s slug $parent = get_term( $term->parent, get_query_var(‘taxonomy’) ); // term’s parent $parent_slug = $parent->slug; // slug of parent term } // … Read more