Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author David Aguilera

    (@davilera)

    Hi!

    Yes, apparently they did change a few things. If I’m not mistaken, the function WooCommerce uses for adding a featured image on archives is (in the end) woocommerce_get_product_thumbnail. Luckily, you can overwrite it and fix its default behavior. Add the following code in your theme’s functions.php file:

    function woocommerce_get_product_thumbnail( $size = 'shop_catalog', $deprecated1 = 0, $deprecated2 = 0 ) {
      global $post;
    
      // Use Nelio's image (if it exists).
      if ( function_exists( 'uses_nelioefi' ) && uses_nelioefi( $post->ID ) ) {
        $img = get_the_post_thumbnail( $post->ID, $size );
        if ( strpos( $img, 'height:' ) > 0 ) {
          $img = preg_replace( '/height:[^;]+;/', '', $img );
        }
        return $img;
      }
    
      // If it doesn't, let's use WC's original code.
      if ( has_post_thumbnail() && wp_attachment_is_image( get_post_thumbnail_id() ) ) {
        return get_the_post_thumbnail( $post->ID, $size );
      } elseif ( wc_placeholder_img_src() ) {
        return wc_placeholder_img( $size );
      }
    }

    Let me know how it works.

    Thread Starter Lakjin

    (@lakjin)

    That works, thanks! Will you be pushing an update to the plugin to address this or should I put this in all my functions.php?

    Plugin Author David Aguilera

    (@davilera)

    Hi!

    I don’t plan to release an update in the short term. Therefore, I think it’ll be better if you upgrade your functions.php files.

    Best,
    David

    Thread Starter Lakjin

    (@lakjin)

    Fair enough, thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Broken with WooCommerce 2.4.13’ is closed to new replies.