Skip to content

Commit f04d387

Browse files
Move filter to compatibilities/woocommerce.php
1 parent 165fa77 commit f04d387

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

inc/compatibilities/woocommerce.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ public function should_load() {
2424
public function register() {
2525
if ( Optml_Main::instance()->admin->settings->use_lazyload() ) {
2626
add_filter( 'optml_lazyload_early_flags', [ $this, 'add_lazyload_early_flag' ], PHP_INT_MAX, 1 );
27+
if ( \Automattic\WooCommerce\Blocks\Utils\CartCheckoutUtils::is_cart_block_default() ) {
28+
add_filter( 'image_downsize', [ Optml_Tag_Replacer::instance(), 'filter_image_downsize' ], PHP_INT_MAX, 3 );
29+
}
2730
}
2831
}
2932
/**

inc/tag_replacer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ public function init() {
4949

5050
parent::init();
5151
add_filter( 'optml_content_images_tags', [ $this, 'process_image_tags' ], 1, 2 );
52-
add_filter( 'image_downsize', [ $this, 'filter_image_downsize' ], PHP_INT_MAX, 3 );
5352

5453
if ( $this->settings->use_lazyload() ) {
5554
return;
5655
}
5756

5857
add_filter( 'optml_tag_replace', [ $this, 'regular_tag_replace' ], 1, 6 );
58+
add_filter( 'image_downsize', [ $this, 'filter_image_downsize' ], PHP_INT_MAX, 3 );
5959
add_filter( 'wp_calculate_image_srcset', [ $this, 'filter_srcset_attr' ], PHP_INT_MAX, 5 );
6060
add_filter( 'wp_calculate_image_sizes', [ $this, 'filter_sizes_attr' ], 1, 2 );
6161
}

0 commit comments

Comments
 (0)