ResolvedRemove link from thumbnail products category

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #25238
    alex_ursu
    Participant

    Hi!

    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?

    #25263
    Althemist
    Keymaster

    Hello alex_ursu,

    here is a good guide on this:

    WooCommerce: Disable Link to Product @ Loop

    Regards,
    Dimitar

    #25281
    alex_ursu
    Participant

    Not working. The theme has a link what start with – prod_hold

    #25283
    alex_ursu
    Participant

    I used that link code in functions and not working.

    #25295
    alex_ursu
    Participant

    ??

    #25304
    Althemist
    Keymaster

    Our lead developer Alex will step in to give you directions.

    #25306
    alex_ursu
    Participant

    Ok, thx

    #25320
    Alex
    Keymaster

    Hello 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 is lafka_shop_loop_image, defined in lafka/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,
    Alex

    #25322
    alex_ursu
    Participant

    I did this, but still not working 🙁

    #25323
    alex_ursu
    Participant

    if ( ! function_exists( ‘lafka_shop_loop_image’ ) ) {

    function lafka_shop_loop_image() {
    global $post;
    echo ‘<div class=”image”>’;

    ?>


    <?php woocommerce_template_loop_product_thumbnail(); ?>
    exists

    #25324
    alex_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”>’;

    ?>


    <?php woocommerce_template_loop_product_thumbnail(); ?>
    <?php
    $second_image = lafka_get_second_product_image_id( $post );

    #25326
    alex_ursu
    Participant

    /lafka/incl/woocommerce-functions.php In this file I made de modification.

    #25327
    Alex
    Keymaster

    Hello 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,
    Alex

    #25425
    alex_ursu
    Participant

    I made this modification, and still not working. The link on image products in categories still working..

    #25445
    Alex
    Keymaster

    I 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

Viewing 15 posts - 1 through 15 (of 15 total)

You must be logged in and have valid license to reply to this topic.

License required for the following item
Login and Registration Log in · Register