Reputation: 1462
I was wondering if there is a way to add a product thumbnail into the buyer's 'Recent Orders' page in 'My Account' in Woocommerce frontend.
I've being trying to find some sort of solution, but no luck whats so ever.
I haven't tried anything to give you a code, just because I have no idea how to actually go about this.
Would someone be able to point me to the right direction ?
Upvotes: 1
Views: 1924
Reputation: 14913
You'll need to edit templates/myaccount/my-orders.php
. Add the following code to where you want the thumbnails to show.
<?php
// Get a list of all items that belong to the order
$products = $order->get_items();
// Loop through the items and get the product image
foreach( $products as $product ) {
$product_obj = new WC_Product( $product["product_id"] );
echo $product_obj->get_image();
}
?>
Upvotes: 4