Site logo

Archived topic

Show product images in cart page

11 replies · Started by Pedro on March 3, 2019

Viewing posts 1–12 of 12

Hello!

I would like the cart page to show the image of the products that have been added to the cart.

How can I do it?

Thank you!

Hi there,

to display them on mobile try this:

.woocommerce-cart table.cart img {
    width: 60px; /* Change for desktop image size */
}

@media (max-width: 768px) {
    
    .woocommerce-page #content table.cart .product-thumbnail {
        display: block;
    }
    .woocommerce-page #content table.cart .product-thumbnail:before {
        content: '';
    }
   .woocommerce-page #content table.cart img {
       width: 80px; /* change for mobile image size */
   }
   .woocommerce-page #content table.cart .product-thumbnail {
    text-align: center !important;
    }
}

Hello david! Thanks for the help.

I placed the CSS and the image is displayed in the mobile version.

However I would like to do the following:

- Enlarge a little more the image of the product in the desktop version.
- Reduce a little more the image of the product in the mobile version.
- Center the product image in the mobile version.

Thank you!!

I edited the CSS above, the two lines for changing the image size have comments beside them, just set the pixel size you want.

Hello david! You are the best, it worked perfect. Thank you!

You're welcome

Hi, just so you know I just tried this and it works but you have to put !important at the end of each line.

Is that something that might have changed since this post?

Thanks.

Hi Sam,

Hi, just so you know I just tried this and it works but you have to put !important at the end of each line.

Is that something that might have changed since this post?

Thanks.

The need for !important means the sequence of how your stylesheets are loaded is altered in a way where the custom CSS you've added loaded before the default WooCommerce CSS. This is not the case for everyone.

Hi Elvin, could that be caused by the Autoptimzed minification plugin?

It is the only thing that could be doing that.

Thanks
Sam

Hi there,

combining / minifying CSS can mess with the order the CSS is printed. So it maybe a case that your custom CSS is being printed before the Mobile CSS Woo loads.

Woo is particularly painful as they use very long specific CSS selector strings, which makes overwriting them a pain. !important can be avoided if you can make the CSS more specific. But i wouldn't be concerned about using !important in custom CSS that is overwriting a stylesheet.

OK noted, thanks for the info.

You're welcome

This archived topic is closed to new replies.