Title: Variation Thumbnail
Last modified: September 4, 2023

---

# Variation Thumbnail

 *  [esspeedee](https://wordpress.org/support/users/esspeedee/)
 * (@esspeedee)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/variation-thumbnail/)
 * Thanks for a really useful plugin. I have used the code snippet in the FAQ to
   display the product thumbnail (get_the_post_thumbnail()). This works well, but
   only shows the main product thumbnail. Is there a code snippet for displaying
   the variation thumbnail? I have products with variations and some without variations,
   so the code should work for both.
 * I tried $variation->get_image_id(); but it crashes…..
 * I have WC 6.8.2 WCDN 4.6.5
 * Any ideas on this?

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [nick1122](https://wordpress.org/support/users/nick1122/)
 * (@nick1122)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/variation-thumbnail/#post-17031965)
 * Hii, [@esspeedee](https://wordpress.org/support/users/esspeedee/) 
   It’s good 
   to know you loved our plugin.I am sharing the modified code snippet for displaying
   the variation thumbnail.
 *     ```wp-block-code
       function add_thumbnail_in_invoice( $product ) {
       	if ( '' !== $product->get_id() ) {
       		$product_id = $product->get_id();
       		if ( has_post_thumbnail( $product_id ) ) {
       			echo get_the_post_thumbnail( $product_id, array( 40, 40 ), array( 'loading' => false ) );
       		}
       	}
       }
       add_action( 'wcdn_order_item_before', 'add_thumbnail_in_invoice', 10, 2 );
       ```
   
 * Please let us know if you need any other help.
   Regards, Nikhil.
 *  Thread Starter [esspeedee](https://wordpress.org/support/users/esspeedee/)
 * (@esspeedee)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/variation-thumbnail/#post-17037567)
 * Hi Nikhil,
 * Sorry its taken a few day to respond. I’ve been away…
 * I have inserted your code and it works perfectly.
 * I just want to say a big thanks for being so responsive and helping me with this.
 *  [nick1122](https://wordpress.org/support/users/nick1122/)
 * (@nick1122)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/variation-thumbnail/#post-17043181)
 * Hi [@esspeedee](https://wordpress.org/support/users/esspeedee/) 
   glad to have
   been help you. Thank you for appreciating.I would be pleased if you would be 
   willing to spend a bit of your precious time to write a review for us on our 
   plugin’s [https://wordpress.org/support/plugin/woocommerce-delivery-notes/reviews/#new-post](https://wordpress.org/support/plugin/woocommerce-delivery-notes/reviews/#new-post)
   review page. That would help immensely.Regards, Nikhil.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Variation Thumbnail’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce-delivery-notes/assets/icon-256x256.jpg?rev=2829362)
 * [Print Invoice & Delivery Notes for WooCommerce](https://wordpress.org/plugins/woocommerce-delivery-notes/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce-delivery-notes/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-delivery-notes/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-delivery-notes/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-delivery-notes/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-delivery-notes/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [nick1122](https://wordpress.org/support/users/nick1122/)
 * Last activity: [2 years, 9 months ago](https://wordpress.org/support/topic/variation-thumbnail/#post-17043181)
 * Status: not resolved