Product Thumbnails in the Checkout Order Summary
Shows a small image beside each product name in the "Your order" table on the classic checkout.
Opens WPIDE on
Code
add_filter( 'woocommerce_cart_item_name', function ( $name, $item, $key ) {
$size = array( 48, 48 ); // Thumbnail size in pixels.
if ( ! is_checkout() || empty( $item['data'] ) ) {
return $name;
}
$thumb = $item['data']->get_image( $size, array( 'style' => 'vertical-align:middle;margin-right:8px;border-radius:3px;' ) );
return $thumb . $name;
}, 10, 3 );
Notes
Change $size to a different image size or pixel array.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.