• Resolved Delite Studio

    (@delitestudio)


    I’m inserting product images in the sidebar. I’m using a text widget with the products shortcode, for example:

    [products ids="20648"]

    The corresponding image contains the correct srcset, but the images that are loaded are too large (and Google’s PageSpeed Insights complains). You can see an example here (see the right sidebar):

    https://cuneotrekking.com

    Do you have any idea how I could solve it?

    Thanks!

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

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Support Ryan Ray, a11n

    (@ryanr14)

    Hi @delitestudio,

    There isn’t a way unfortunately to control the image used, it looks to use the product image size by default without an option to say use the thumbnail size.

    Thread Starter Delite Studio

    (@delitestudio)

    Thanks for your answer! In your opinion there is another way that allows me to show a product (with photo, title, price and purchase button) but with a smaller image that can fit well in the sidebar?

    Thanks again for your time.

    Kenin

    (@kbassart)

    Automattic Happiness Engineer

    Hi there,

    I tested this with our Storefront theme, and the Products shortcode functions well in the Sidebar as seen in the screenshot here: https://cld.wthms.co/PNbOY

    If it’s loading too large with your theme, you may want to contact your theme developer for assistance to see if they can help get the image size adjusted for you.

    Thread Starter Delite Studio

    (@delitestudio)

    Hello Kenin,

    I’m not sure it’s a problem of our theme (which is custom made), because the shortcode works perfectly also in our theme, as you can see by going to the cuneotrekking.com home page, but the images shown are larger than what would be sufficient… but I could miss something ??

    Thanks for your time!

    jessepearson

    (@jessepearson)

    Automattic Happiness Engineer

    @delitestudio It looks like your theme is setting your thumbnail size to 750px wide, which will give you a much larger image than what is needed. This can be seen in your regular shop page, as well:


    Link to image: https://cld.wthms.co/dCDrFb

    The default width for these images is 300px, which should be all that is ever needed.

    Thread Starter Delite Studio

    (@delitestudio)

    Thanks. Not sure if I’m missing something, but I do not understand where that 750px comes out, because in reality the sizes are set in this way under Settings → Media:

    https://cuneotrekking.com/wp-content/uploads/wc-shot1.png

    Moreover, when I load a media here are the files that are generated in the wp-uploads folder:

    https://cuneotrekking.com/wp-content/uploads/wc-shot2.png

    As you can see there are many sizes smaller than 750px…

    These are the add_theme_support() in our theme:

    add_theme_support('woocommerce');
    add_theme_support('wc-product-gallery-zoom');
    add_theme_support('wc-product-gallery-lightbox');
    add_theme_support('wc-product-gallery-slider');
    add_theme_support('post-thumbnails');
    	
    add_image_size('cuneotrekking', 800, 533);
    	
    update_option('thumbnail_size_w', 170);
    update_option('medium_size_w', 470);
    update_option('large_size_w', 970);

    Any ideas?

    Thanks!

    jessepearson

    (@jessepearson)

    Automattic Happiness Engineer

    @delitestudio Install Simple Image Sizes, then go back to the Media page to see what the woocommerce_thumbnail image size is set to.

    Thread Starter Delite Studio

    (@delitestudio)

    Bingo! I can see woocommerce_thumbnail, woocommerce_single, shop_catalog, and shop_single all set to 750px. That’s great: so I should change these values and then regenerate the thumbnails. I imagined it was not just a matter of theme ??

    Thank you very much for your time!

    jessepearson

    (@jessepearson)

    Automattic Happiness Engineer

    @delitestudio

    so I should change these values and then regenerate the thumbnails

    Correct. Those are not the default sizes, so something had to update them at some point.

    Kenin

    (@kbassart)

    Automattic Happiness Engineer

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Products shortcode srcset’ is closed to new replies.