WordPress.org

Forums

WooCommerce - excelling eCommerce
Cant find the Thumbnail Loop and overwritte the filter (2 posts)

  1. cannap
    Member
    Posted 1 year ago #

    Hi im working on a plugin now i have a problem i can change the Single Thumbnail and add class. But i cant filter the thumbnails in the loop

    i want to do de the same thing in the thumbnail loop

    remove_filter('woocommerce_single_product_image_html', 'woocommerce_single_product_image_html');
    add_filter('woocommerce_single_product_image_html', 'overwritte_product_image');
    
        function overwritte_product_image($post) {
            global $post;
            $the_thumbnail_id = get_post_thumbnail_id( $post->ID );
            $image_link = wp_get_attachment_url( $the_thumbnail_id );
            $image       = wp_get_attachment_image( $the_thumbnail_id, apply_filters( 'single_product_small_thumbnail_size', 'shop_single' ) );
            $image_title = esc_attr( get_the_title( $post->ID) );
    //Check if User has Acces and then Put a span with "freeprodukt"
            if (user_has_access($post->ID) == 2) {
            echo sprintf( '<li><span class="free-item" style="position:absolute; display:block; background: #ed5a48; color:white; bottom:0; padding:15px;">Freigeschalten!</span><a href="%s" itemprop="image" class="woocommerce-main-image zoom" title="%s"  data-rel="prettyPhoto">%s</a></li>', $image_link, $image_title, $image );
    
            } else {
                echo sprintf( '<li><a href="%s" itemprop="image" class="woocommerce-main-image zoom" title="%s"  data-rel="prettyPhoto">%s</a></li>', $image_link, $image_title, $image );
            }
    
        }

    http://wordpress.org/plugins/woocommerce/

  2. cannap
    Member
    Posted 1 year ago #

    i found this woocommerce_template_loop_product_thumbnail but is nothing happens

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce - excelling eCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic