• Resolved Michele

    (@msustudio)


    When selecting a variant, the variant image only loads one pixel in height. We tried deactivating all plugins and changing themes. We thought maybe it was due to us not upgrading to WP 5.9, so we upgraded as well with no luck.

    We tried this code as well from a previous topic, but does not do anything.

    function wgs_gallery_reset () { 
    	if( is_product() ) { ?>
    	<script>
    		(function($){
    			$(document).on('ready', function(){
    				
    				$(document).on('change', '.variations select', function () {
    					setTimeout(function () { 
    						if( $('.wcgs-carousel .slick-list').outerHeight() == 1 ){
    							$('.wcgs-carousel').slick('refresh');
    						}
    					}, 300);
    				});
    			});
    		})(jQuery);
    	</script>
    	<?php  } 
    }
    add_action( 'wp_footer', 'wgs_gallery_reset', 99 );
    • This topic was modified 3 years, 2 months ago by Michele.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Bayejid Ahmed

    (@bayejid00)

    Hi,

    Sorry for the inconvenience.

    We have noted the image loading issue in the development roadmap and it will be resolved in the future version.

    You may use the revised code in the current theme’s functions.php file.

    function wgs_gallery_reset_modified () { 
    	if( is_product() ) { ?>
    	<script>
    		(function($){
    			$(document).on('change', '.variations select', function () {
    				setTimeout(function () { 
    					if( $('.wcgs-carousel .slick-list').outerHeight() == 1 ){
    						$('.wcgs-carousel').slick('refresh');
    					}
    				}, 1500);
    			});
    		})(jQuery);
    	</script>
    	<?php  } 
    }
    add_action( 'wp_footer', 'wgs_gallery_reset_modified', 99 );

    Let us know if it works or not. For further queries, create a ticket here.

    Thread Starter Michele

    (@msustudio)

    Increasing the timeout and removing document.load does the trick, but I also found it loads with 0px at times. Here is the code that I have found to work for me:

    function wgs_gallery_reset () { 
    	if( is_product() ) { ?>
    	<script>
    			(function($){
    			$(document).on('change', '.variations select', function () {
    				setTimeout(function () { 
    					if( $('.wcgs-carousel .slick-list').outerHeight() < 2 ){
    						$('.wcgs-carousel').slick('refresh');
    					}
    				}, 1000);
    			});
    		})(jQuery);
    	</script>
    	<?php  } 
    }
    add_action( 'wp_footer', 'wgs_gallery_reset', 99 );
    Plugin Support Bayejid Ahmed

    (@bayejid00)

    Hi @msustudio,

    Thank you for your effort.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Variant Image Not Loading’ is closed to new replies.