a3-lazy-load icon indicating copy to clipboard operation
a3-lazy-load copied to clipboard

Product thumbnails not lazy loaded on category page

Open alibasheer opened this issue 6 years ago • 3 comments

Using:

  • WooCommerce 5.0+
  • a3 Lazy Load: 1.9.1
  • WordPress: 4.9.8
  • Theme Twenty Seventeen: 1.7

Images in /shop/ or /category/category-name/ is not lazy loaded.

Note that:

  • Lazy load CSS and JS files are included in the pages
  • .lazy-hidden is not added to the images

alibasheer avatar Dec 02 '18 14:12 alibasheer

The below commit on WooCommerce caused the issue: https://github.com/woocommerce/woocommerce/commit/6ed2ebb3ba97b84b7d39fa3ebd3e6c545fff18cc#diff-bad16647d10a7365519084a2fc793cbb

alibasheer avatar Dec 06 '18 23:12 alibasheer

A fix:

function lebelik_woocommerce_product_get_image( $image, $this_product, $size, $attr ){
	if ( $this_product->get_image_id() ) {
		$image = get_the_post_thumbnail( $this_product->get_id(), $size, $attr );
	}
	return $image;
}
add_filter( 'woocommerce_product_get_image', 'lebelik_woocommerce_product_get_image', 10, 4 );

alibasheer avatar Dec 07 '18 13:12 alibasheer

Hi @alibasheer, Thank you so much for this! Can confirm the fix works and is still required.

@a3rev Any plans to include in an update?

JapeNZ avatar Dec 20 '19 23:12 JapeNZ