ResolvedRemove link from thumbnail products category
- This topic has 14 replies, 3 voices, and was last updated 3 years, 3 months ago by
Alex.
- AuthorPosts
- August 21, 2020 at 4:07 pm #25238
alex_ursu
ParticipantHi!
I want to remove the link to product from category page. Now when I click on the image product in category page, the link send me to the product. I want to remove that. From the title I removed, but from the thumbnail product I not found the line in prod_hold.
I want to remove the link or to change with quick view link order now button.
Can you help me, please with this?
August 24, 2020 at 3:45 pm #25263Althemist
KeymasterHello alex_ursu,
here is a good guide on this:
Regards,
DimitarAugust 24, 2020 at 4:56 pm #25281alex_ursu
ParticipantNot working. The theme has a link what start with – prod_hold
August 24, 2020 at 4:58 pm #25283alex_ursu
ParticipantI used that link code in functions and not working.
August 25, 2020 at 8:55 am #25295alex_ursu
Participant??
August 25, 2020 at 1:43 pm #25304Althemist
KeymasterOur lead developer Alex will step in to give you directions.
August 25, 2020 at 1:50 pm #25306alex_ursu
ParticipantOk, thx
August 25, 2020 at 3:35 pm #25320Alex
KeymasterHello alex_ursu,
There is a function hooked to ‘woocommerce_before_shop_loop_item’ filter, which outputs the image html for category product list.
The function islafka_shop_loop_image
, defined inlafka/incl/woocommerce-functions.php
.To remove the link, replace
the_permalink()
with#
.Please make this changes in a child theme’s functions.php file in order to still have it after update. Just declare function with the same name and it will override it.
Regards,
AlexAugust 25, 2020 at 5:04 pm #25322alex_ursu
ParticipantI did this, but still not working 🙁
August 25, 2020 at 5:09 pm #25323alex_ursu
Participantif ( ! function_exists( ‘lafka_shop_loop_image’ ) ) {
function lafka_shop_loop_image() {
global $post;
echo ‘<div class=”image”>’;?>
<?php woocommerce_template_loop_product_thumbnail(); ?>
existsAugust 25, 2020 at 5:10 pm #25324alex_ursu
Participant* Takes into account product_hover_onproduct theme option
*/
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_thumbnail’, 10);
add_filter(‘woocommerce_before_shop_loop_item’, ‘lafka_shop_loop_image’, 10);if ( ! function_exists( ‘lafka_shop_loop_image’ ) ) {
function lafka_shop_loop_image() {
global $post;
echo ‘<div class=”image”>’;?>
August 25, 2020 at 5:11 pm #25326alex_ursu
Participant/lafka/incl/woocommerce-functions.php In this file I made de modification.
August 25, 2020 at 5:52 pm #25327Alex
KeymasterHello alex_ursu,
You should know that directly changing /lafka/incl/woocommerce-functions.php file will lead to loosing your changes on the next theme update.
If you are sure you will never update the theme, than ok.If this is the case, then in /lafka/incl/woocommerce-functions.php file, change following code in line 65:
<a href="<?php the_permalink(); ?>">
to
<a href="#">
Again, we don’t recommend this approach. It will be better to copy the whole function in the child theme’s functions.php file and make the modification there. If you are not familiar with Child themes, please look at this great WordPress article: Child Themes
Regards,
AlexAugust 31, 2020 at 9:06 am #25425alex_ursu
ParticipantI made this modification, and still not working. The link on image products in categories still working..
September 1, 2020 at 4:06 pm #25445Alex
KeymasterI am sorry, but if it is still working, then you are doing something wrong.
I’ve tested and it works.If you struggle with modifying PHP code, you can hire someone to help.
Regards,
Alex - AuthorPosts
You must be logged in and have valid license to reply to this topic.