How to get WooCommerce Product Category Link by ID?

You can use get_term_link to get the URL of Product. Category ID needed to be converted to an integer.

     $woo_cat_id_int = (int)$woo_cat_id;
     $term_link = get_term_link( $woo_cat_id, 'product_cat' );
     echo '<a href="' . esc_url( $term_link ) . '">' . $term-&gt;name . '</a>';

If you have the term Object then you can simply get the link by using below code

    $term_link = get_term_link( $term );
    echo '<a href="' . esc_url( $term_link ) . '">' . $term-&gt;name . '</a>';

Leave a Reply

Your email address will not be published. Required fields are marked *