在 WooCommerce 商店页面的类别中添加“查看更多”按钮-WordPress问题论坛-WordPress-光子社区 | 技术交流与生活分享的理想平台
3
share (joys, benefits, privileges etc) with others

Add a "See More" button to the categories on the WooCommerce store page

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.

d2b5ca33bd20240910183112

 

I'd like the result below, can you say where it needs to be changed ⬇️⬇️⬇️

d2b5ca33bd20240910182816

 

Please log in to post a comment

    return (to a previous condition)1
    See only the author.