You could output a meta preload link to the image from the “wp_head” action. The crucial aspect would be obtaining the correct image URL from within the callback. The issue is this call happens outside the “Loop” so the usual template tag functions to get product images may not work. However, at least with single product pages, I believe the global $post variable is already assigned the current post/product object, so getting the right image URL should be feasible.
Failing global $post being assigned, get_queried_object() ought to get the right post/product for single product requests. With the correct object, we can get its featured image URL with get_the_post_thumbnail_url(). I don’t know if that is the same as main product image or not. Use whatever function is needed, assuming it takes a post object or ID as a parameter. You can likely learn the correct function from the template code responsible for image output. Or ask though your e-commerce plugin’s support channel for suggestions.
Thread Starter
saens
(@saens)
Thanks! I’ll look into that.