Home Forums Themes Support Pangja How to Make WooCommerce Thumbnails Clickable ?

This topic contains 1 reply, has 2 voices, and was last updated by  admin 2 months, 1 week ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #3174

    Hi,

    Everything is in the title.
    For now, only the title of the product is clickable and I would like to add the product link to the thumbnail.

    I tried to modify the functions.php file but it doesn’t work.

    Can you help me ?

    Thank you.

    #3176

    Hi,
    Thanks for contacting us and choosing our product!
    Now we don’t add link on the thumbnail because hover will become click on mobile and you don’t see button when hover on desktop.
    However in this case you can use child theme to override template display follow this topic tutorial:

    How to customize WordPress theme using Child theme


    In this case you need to customize template wp-content/themes/pangja/woocommerce/content-product.php
    You can insert link for thumbnail here:

    <a href="<?php echo get_permalink( $product->get_id() ?>">
    <div class="product-thumbnail">
                <?php
                /**
                 * woocommerce_before_shop_loop_item_title hook.
                 *
                 * @hooked woocommerce_show_product_loop_sale_flash - 10
                 * @hooked woocommerce_template_loop_product_thumbnail - 10
                 */
                add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_link_open', 5 );
                remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 );
                add_action( 'woocommerce_before_shop_loop_item_title', 'haru_woocommerce_template_loop_product_thumbnail', 10);
                add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_link_close', 10 );
                do_action( 'woocommerce_before_shop_loop_item_title' );
                ?>
                <div class="product-varations">
                    <?php
                    /**
                     * haru_woocommerce_product_variations hook
                     *
                     * @hooked haru_product_attribute_variation - 5
                     */
                    do_action( 'haru_woocommerce_product_variations' );
                    ?>
                </div>
                <div class="product-actions">
                    <?php
                    /**
                     * haru_woocommerce_product_actions hook
                     *
                     * @hooked haru_woocomerce_template_loop_compare - 5
                     * @hooked haru_woocomerce_template_loop_wishlist - 10
                     * @hooked woocommerce_template_loop_add_to_cart - 20
                     * @hooked haru_woocomerce_template_loop_quick_view - 25
                     */
                    do_action( 'haru_woocommerce_product_actions' );
                    ?>
                </div>
            </div>
    </a>

    An other solution you can go to wp-content/themes/pangja/framework/includes/woocommerce-functions.php then remove these lines on like 234 and 235:

        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 );

    Hope this help!

    *****
    Regards,
    HaruTheme

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

You must be logged in to reply to this topic.