function get_categor_product($categor_list = "") {
$get_categor_product = get_terms("product_cat", [
"orderby" => "name",
"order" => "ASC",
"hide_empty" => 1,
]);
if(count($get_categor_product) > 0) {
$categor_list = '<ul class="hsa-nav__items">';
foreach($get_categor_product as $categories_item) {
$categor_list .= '<li><a href="'.esc_url(get_term_link((int)$categories_item->term_id)).'">'.esc_html($categories_item->name).'</a></li>';
}
$categor_list .= '</ul>';
}
return $categor_list;
}
function mynew_product_categories( $args = array() ) {
$parentid = 0;
$args = array(
'parent' => $parentid
);
$terms = get_terms( 'product_cat', $args );
if ( $terms ) {
echo '<ul class="hsa-nav__items">';
foreach ( $terms as $term ) {
echo '<li>';
echo '<a href="' . esc_url( get_term_link( $term ) ) . '" class="' . $term->slug . '">';
echo $term->name;
echo '</a>';
echo '</li>';
}
echo '</ul>';
}
}
function mynew_product_subcategories( $args = array() ) {
$parentid = get_queried_object_id();
$args = array(
'parent' => $parentid
);
$terms = get_terms( 'product_cat', $args );
if ( $terms ) {
echo '<nav class="internal-nav">';
echo '<ul class="has-drag">';
foreach ( $terms as $term ) {
echo '<li>';
echo '<a href="' . esc_url( get_term_link( $term ) ) . '" class="' . $term->slug . '">';
echo $term->name;
echo '</a>';
echo '</li>';
}
echo '</ul>';
echo '</nav>';
}
}