[Resolved] Images of Woocommerce at the same height

Home Forums Support [Resolved] Images of Woocommerce at the same height

Home Forums Support Images of Woocommerce at the same height

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #705004
    Alberto

    Hi.

    How would you have to configure GP so that the woocommerce images have the same height, regardless of the size of the images?

    Thank you in advance.

    Problem

    GP Premium 1.7.2
    #705029
    David
    Staff
    Customer Support

    Hi there,

    can you link me to the Site? you can edit the original topic and use the Site URL for privacy.
    We may be able to use some CSS to make this happen. But ideally it is better to use images that are all the same aspect ratio.

    #705032
    Alberto

    Hi.

    I just edited the url of the site.

    Thanks since now!

    #705076
    David
    Staff
    Customer Support

    OK, so try this CSS:

    @media (min-width: 768px) {
        .inside-wc-product-image {
            width: 100%;
        }
        .woocommerce ul.products li.product a img {
            height: 200px; /* adjust height */
            object-fit: cover;
        }
    }
    #705078
    Alberto

    Thank you! It worked perfectly!

    Can the height of the titles also be equal?

    Thank you in advance.

    #705083
    David
    Staff
    Customer Support

    Try this:

    .woocommerce ul.products li.product h2 {
        line-height: 2.5ex;
      	height: 7.5ex;
      	overflow: hidden;
    }
    #705086
    Alberto

    Thank you! It worked perfectly!

    #705089
    David
    Staff
    Customer Support

    Awesome 🙂 Glad i could be of help.

    #983348
    Raul

    Hello David, I am trying to to the same Alberto asked, but I want the images centered horizontally. The CSS seems to affect the magnifier icon position as well as the product gallery thumbnails.

    This is the code I am using:

    @media (min-width: 768px) {
        .inside-wc-product-image {
            width: 100%;
        }
        .woocommerce div.product div.images img {
            height: 700px; /* adjust height */
            width: auto;
            margin: 0 auto;
        }
    }
    
    .woocommerce div.product div.images .woocommerce-product-gallery__trigger {
        margin: 0 auto;
    }

    A sample of a long vertical image: http://35.232.201.230/~suzanne2/shop/publications/embodied-fantasies-from-awe-to-artifice/
    A sample of a gallery with 3 images: http://35.232.201.230/~suzanne2/shop/artworks/remote-sensing/remote-sensing-01/

    Note images get distorted… What do you recommend?

    Thanks

    #983503
    David
    Staff
    Customer Support

    Hi there,

    its best to avoid the CSS for now, the key thing with Woocommerce images is:

    1. Original Image should be large enough for your Single Product Magnified image around 1.5x to 2x the Main Image unzoomed.
    2. The Customizer > Woocommerce > Main Image width should be equal to the Container width.
    2.1 The Container width is set as a % in Customizer > Layout > Woocommerce > Product Image Area Width – currently yours is 60% of the Page Container width which is set to 1400px. So the Main Image Width should be 840px in your current set-up. This means your original image needs to be larger ( refer back to point 1 )

    #1795646
    Kieran

    Thanks for this code David, simple and works. I changed: object-fit: cover; to object-fit: contain; which suited my needs.

    #1795703
    David
    Staff
    Customer Support
Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.