How to off lazy load on checkout page?
-
Як уникнути цього зміщення через ледаче навантаження? Можливо, додати атрибут до зображення у php? https://www.awesomescreenshot.com/video/5325663
Hello,
Try to add the following PHP code snippet to the child theme functions.php file to do this
function woodmart_disable_lazy_on_page() {
$current_page_id = get_queried_object_id();
if ( ! $current_page_id ) {
$current_page_id = get_the_ID();
}
$pages = [
107, 108,
];
if ( in_array( $current_page_id, $pages ) ) {
woodmart_lazy_loading_deinit( true );
}
}
add_action( 'wp', 'woodmart_disable_lazy_on_page', 1000 );
In the above code, you need to replace the values under the "$page"
array with the pages ids.
Regards.
Xtemos Studios.
Thanks.
I added but it not work. Check please
Hello,
Actually, we have Theme Settings presets functionality. And this allows you to disable any option on any page. So the code is no longer required.
I have added the preset in Theme Settings with Checkout page Preset and disable the Lazy load option only for the Checkout page.
You can read more about preset here in the theme documentation:
https://xtemos.com/docs/woodmart/theme-settings-presets/
Best Regards.
Now lazy loading don’t work on all site on mobile version. Check one more time please
I want to off lazy loading only on checkout page and not everywhere
Try to add the following code snippet to the Custom JS area in Theme Settings to fix this issue.
jQuery(document).on('updated_checkout', function() {
jQuery(document).trigger('wood-images-loaded');
});