Add a "view more" button to categories on WooCommerce shop page

I have woocommerce set to only show categories (instead of products) upon entering the shop page and I want every category to have a “View More” button with it’s corresponding URL like a product would.

Here’s my code:

add_action( 'woocommerce_after_subcategory_title', 'view_category_button', 10 );
function view_category_button() {
    $link = get_term_link( (int)$product_cat_id, 'product_cat' );   
    echo '<a href="' . $link . '"> View more </a>';
}

However, the code fails to show the button and breaks the loading of the store.

Here’s a pic of what I want: https://imgur.com/98arCfL

Here’s a pic of what I get: https://imgur.com/xwLK6r0