I'm using woocommerce on a site I'm working on and I want to display the current product thumbnail at the top of the checkout page, so the user could take a look at what his going to buy.
However I can't find any way to do so.
The closest I got, is to use WC::cart->get_cart()
, but this outputs a list of all products.
How can I achieve this?
Thanks
Yes it's possible writing a custom function.
To display those images at the beginning of checkout page just after your header's theme, use this code:
This code snippet goes on function.php file of your active child theme or theme
You can change the images properties adding some options in get_image() function.
This code is tested and fully functional
OTHER USAGES - You can also use it:
1) With the following others checkout WooCommerce hooks (replacing the first line in the snippet code with one of this):
• Before customer details:
• After customer details:
• Before order review:
2) Directly inside your woocommerce templates (this snippet code goes on function.php file of your active child theme or theme):
Then you will just paste one of this inside the template file:
<?php displays_cart_products_feature_image(); ?>
displays_cart_products_feature_image();
Reference: