1

I'm trying to add an image from the product gallery to the Woocommerce checkout. I've managed it on the cart using the following code:

                        $product = new WC_product($product_id);
$attachment_ids = $product->get_gallery_attachment_ids();

foreach( $attachment_ids as $attachment_id ) 
    {

      // Display Image instead of URL
      echo wp_get_attachment_image($attachment_id, 'full');

    }

But this won't work in the checkout. I've currently got the main product image showing using this code:

$thumbnail = apply_filters( 'woocommerce_in_cart_product_thumbnail', $_product->get_image(), $values, $cart_item_key ); echo $thumbnail;

But I can't figure out how to adapt it to allow the gallery image through.

Any help would be appreciated!

Cheers,

Ash

Ash Loudon
  • 102
  • 1
  • 11

0 Answers0