Product category page with no link to product detail page
Support Forums › Kampina › Product category page with no link to product detail page
- This topic has 3 replies, 2 voices, and was last updated 4 months, 1 week ago by
TigriWeb.
-
AuthorPosts
-
June 26, 2025 at 3:32 pm #224
yweb1
ParticipantHello,
On the website I use your Kampina theme for a campsite in a farm, I decided to use the product mechanism to show also attractions, products made by the farmer and must-see touristic sites in the area. But for these 3 categories of products (and only these 3, not hosting), I would like to have only the product category page availabe, with no access to the product detail page.
I tried the following code, found on forums and added in functions.php, but it does not work with the theme; if I remove the IF, it breaks the layout of the product category pages. :// Remove links to the product details pages from the product listing page of a WooCommerce store (only a specific category) // equipements, produits-ferme, animations-paysannes, a-visiter if ( is_product() && is_product_category('produits-ferme') ) { remove_action( 'woocommerce_before_shop_loop_item', 'woocommerce_template_loop_product_link_open', 10 ); remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_product_link_close', 5 ); remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_link_open', 10 ); remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_product_link_close', 5 ); }Thanks for your help.
Regards,
YvanJune 26, 2025 at 5:40 pm #225TigriWeb
KeymasterHi Yvan,
We also use these hooks in the Kampina theme, so try this code:
function kampina_fix_template_loop_product_link_open() { ?><div class="woocommerce-LoopProduct-link woocommerce-loop-product__link"><?php } function kampina_fix_template_loop_product_link_close() { ?></div><?php } function kampina_fix_template_loop_product_title() { ?><h2 class="<?php echo esc_attr( apply_filters( 'woocommerce_product_loop_title_classes', 'woocommerce-loop-product__title' ) ); ?>"><?php the_title(); ?></h2><?php } function kampina_fix_loop_add_to_cart_link() { echo ''; } add_action( 'template_redirect', function() { if ( is_product_category( 'produits-ferme' ) ) { // without is_product(). // remove thumbnail a. remove_action( 'woocommerce_before_shop_loop_item', 'woocommerce_template_loop_product_link_open', 10 ); remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_link_close', 10 ); // add thumbnail div. add_action( 'woocommerce_before_shop_loop_item', 'kampina_fix_template_loop_product_link_open', 10 ); add_action( 'woocommerce_before_shop_loop_item_title', 'kampina_fix_template_loop_product_link_close', 10 ); // remove title a. remove_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title', 10 ); // add title h2. add_action( 'woocommerce_shop_loop_item_title', 'kampina_fix_template_loop_product_title', 10 ); // remove button. add_filter( 'woocommerce_loop_add_to_cart_link', 'kampina_fix_loop_add_to_cart_link', 10, 3 ); // remove button aria-describedby span. add_filter( 'woocommerce_loop_add_to_cart_args', '__return_false' ); } } );Best regards,
TigriWeb TeamJune 30, 2025 at 10:36 am #235yweb1
ParticipantHello,
Thanks again, it works great !
As suggestion, it may be an improvement of your theme, to have a dedicated page with amenities and attractions managed as products, with links from the home page to the pages. It would allow to have exerpts on the home page, and more details on the product category page.Regards,
YvanJuly 2, 2025 at 5:10 pm #236TigriWeb
KeymasterHi Yvan,
Creating a dedicated page for amenities and attractions managed as products, with excerpts on the home page and detailed views on category pages, sounds like a valuable improvement. I will definitely consider implementing this in the future updates.
Thanks again for your feedback and support!
Best regards,
TigriWeb Team -
AuthorPosts
- You must be logged in to reply to this topic.