I have woocommerce set to show only categories (not products) when going to the store page, and I want each category to have a "View More" button and its corresponding URL, just like the product.
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 ';
}
However, the code fails to display the button and interrupts the loading of the store, which is not right.
I'd like the result below, can you say where it needs to be changed ⬇️⬇️⬇️