• For those whose “click to view” in woocommerce shop archive page stopped working after new Woocommerce update, the “get post thumbnail” option was changed. So to fix, just add this into your child theme functions.php and the featured video plus will again work ??

    //fix for shop archive featured image get post thumb
    remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10);
    add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10);
    
    if ( ! function_exists( 'woocommerce_template_loop_product_thumbnail' ) ) {
        function woocommerce_template_loop_product_thumbnail() {
            echo woocommerce_get_product_thumbnail();
        } 
    }
    if ( ! function_exists( 'woocommerce_get_product_thumbnail' ) ) {   
        function woocommerce_get_product_thumbnail( $size = 'shop_catalog', $placeholder_width = 0, $placeholder_height = 0  ) {
            global $post, $woocommerce;
            $output = '<div class="imagewrapper">';
    
            if ( has_post_thumbnail() ) {               
                $output .= get_the_post_thumbnail( $post->ID, $size );              
            }                       
            $output .= '</div>';
            return $output;
        }
    }
    
Viewing 1 replies (of 1 total)
  • Hello @ideahost !

    Thank you so much for your help, i added the code and it works for the archive page but can you help me because i want to do the same thing for the first picture in my single product page. Unfortunately, when i changed the code in functions.php i saw my featured video in the single product page but i lost the gallery images.
    please help or email me ?? i can show you what i want as result if you want to understand my issue.

Viewing 1 replies (of 1 total)
  • The topic ‘YAY-Fix for new Woocommerce Shop Archive’ is closed to new replies.