• Resolved mrwindowsx

    (@mrwindowsx)


    Hi,

    I disable function jetpack site accelerator and lazy loading for images on my jetpack setting page, however, there is still an inline js script like below inside my resource load,

    <script type='text/javascript' id='wc-cart-fragments-js-after'>
    		jQuery( 'body' ).bind( 'wc_fragments_refreshed', function() {
    			var jetpackLazyImagesLoadEvent;
    			try {
    				jetpackLazyImagesLoadEvent = new Event( 'jetpack-lazy-images-load', {
    					bubbles: true,
    					cancelable: true
    				} );
    			} catch ( e ) {
    				jetpackLazyImagesLoadEvent = document.createEvent( 'Event' )
    				jetpackLazyImagesLoadEvent.initEvent( 'jetpack-lazy-images-load', true, true );
    			}
    			jQuery( 'body' ).get( 0 ).dispatchEvent( jetpackLazyImagesLoadEvent );
    		} );

    I reenable and disable both the jetpack site accelerator and lazy loading for images many times and clearing all my cache, but it still there. I don’t know if this is a bug or whatever that produced by jetpack with Woocommerce script fragment js, I want to remove this inline js script due to conflict with my theme optimization plugin, please your help.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support fresatomica

    (@fresatomica)

    Hi there!

    WordPress 5.5 comes with lazy loading, so if this feature is disabled within Jetpack then you may try to add this filter:

    add_filter( 'wp_lazy_loading_enabled', '__return_false' );

    I hope that helps ??

    Thread Starter mrwindowsx

    (@mrwindowsx)

    Hi,

    I added that code in my child theme function and activated it, cleared the cache but nothing has changed, the inline js is still there, this js code was injected by lazy jetpack, there should be a way to clear it, please your help.

    Thanks in advance.

    Plugin Support fresatomica

    (@fresatomica)

    If you remove Jetpack completely does the JS go away? How and where exactly do you see the issue? After a closer look, the JS is probably coming from WooCommerce
    <script type='text/javascript' id='wc-cart-fragments-js-after'>

    If that’s the case, you’ll either want to ignore it, disable WooCommerce to see if that removes the inline script, or find a day to disable cart fragments, as explained here: https://github.com/woocommerce/woocommerce/issues/7777#issuecomment-83984503.
    Note, however, that dequeuing this could have unintended consequences.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Problem with jetpack Lazy Images Load script and woocommerce cart’ is closed to new replies.