WooCommerce: Show Product Images @ Checkout Page

The Order Review section of the WooCommerce Checkout Page shows the product name, quantity and subtotal. No sign of the product image, which can be very useful to identify/differentiate between similar products or product variations.

This simple snippet will help you display just that: the featured image beside the product name inside the order review table. Easy peasy. Enjoy!

By adding the PHP snippet below, you can quickly display product featured images beside the product name in the Checkout page

PHP Snippet: Add Product Featured Image @ WooCommerce Checkout Page Order Review Table

Please note the snippet below will generate a thumbnail with size 50*50 pixels (feel free to change that size inside the array()) and will align it to the left (remove the array containing the class to avoid that in case).

/**
 * @snippet       Product Images @ Woo Checkout
 * @how-to        businessbloomer.com/woocommerce-customization
 * @author        Rodolfo Melogli, Business Bloomer
 * @compatible    WooCommerce 5
 * @community     https://businessbloomer.com/club/
 */
 
add_filter( 'woocommerce_cart_item_name', 'bbloomer_product_image_review_order_checkout', 9999, 3 );
 
function bbloomer_product_image_review_order_checkout( $name, $cart_item, $cart_item_key ) {
    if ( ! is_checkout() ) return $name;
    $product = $cart_item['data'];
    $thumbnail = $product->get_image( array( '50', '50' ), array( 'class' => 'alignleft' ) );
    return $thumbnail . $name;
}

Where to add custom code?

You should place custom PHP in functions.php and custom CSS in style.css of your child theme: where to place WooCommerce customization?

This code still works, unless you report otherwise. To exclude conflicts, temporarily switch to the Storefront theme, disable all plugins except WooCommerce, and test the snippet again: WooCommerce troubleshooting 101

Related content

Rodolfo Melogli

Business Bloomer Founder

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza. Follow @rmelogli

26 thoughts on “WooCommerce: Show Product Images @ Checkout Page

  1. Hi,
    Thank you for this amazing code!
    In the mobile the image is not showing, only on desktop.

    How i can fix it?

    1. Uhm, it works for me. Can you try temporarily to switch to the Storefront theme and see if it works (this is what I use in my dev site)? If yes, then it’s a problem with your custom theme and may need a code tweak to make it compatible

  2. Hi, thank you! Your guide was very useful for us!

  3. Cool thanks for this snippet

  4. It gave me this error I need your help please and thank you

  5. Hi thx for the guide, it works at the pc but doesnt work on mobile, may i know how to do it on mobile type?

    1. Even if you temporarily switch to – say – Storefront theme? I fear it may be your custom theme

  6. Hi there
    this was working perfectly on woodmart theme, but suddenly there are two pictures at check out. Any ideas why this would be?
    I checked I hadn’t duplicated the snippet, but after that, I don’t know!
    Thank you
    Amy

    1. ooops sorry I have just realised I put this up earlier! I’m seeing double everywhere now!

      No prob!

      1. I am still getting two pictures of each product at checkout. Any ideas as to how this could happen?

        1. I find that odd. What if you switch temporarily to another theme – does it work ok?

  7. Thank you very much for your help
    I was able to display the product image in the checkout section
    Can you help me how can I add a product attribute to this section?
    Help us if you can

    1. Hello Hamed, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

  8. Hi! Thank you so much for this, it’s wonderful. The only issue is my thumbnails are showing up twice – one right next to the other. Any idea on why this could be happening?

    Thanks so much.

    Siobhan

    1. Even if you try the snippet with another theme? This may be because your theme’s custom PHP code

  9. It used to work but after the latest Woo update some products images are now kept at their original width/height in the checkout table, though there are no differences inspecting the CSS.
    Do you have any idea how it happened?

    1. You may need custom CSS for that

  10. Thank you for the code. It’s working perfectly on desktop but the product title does not aligned properly on mobile. Hope you can fix it.

    1. It’s probably your custom theme. You’ll need custom CSS for that

  11. I’m always delighted to receive your newsletter

    Please consider sharing snippets to improve the checkout page to enhance one page checkout experience – with options like Remove from cart and quantity increase/decrease

  12. Nice, I have been thinking how to implement this for a while now. THANK YOU!

Questions? Feedback? Customization? Leave your comment now!
_____

If you are writing code, please wrap it like so: [php]code_here[/php]. Failure to complying with this, as well as going off topic or not using the English language will result in comment disapproval. You should expect a reply in about 2 weeks - this is a popular blog but I need to get paid work done first. Please consider joining the Business Bloomer Club to get quick WooCommerce support. Thank you!

Your email address will not be published. Required fields are marked *