lundi 23 mars 2015

Making product image in woocommerce invoice linkable


So, I am customizing woocommerce invoice email and here is a portion which displays product images in the email invoice:



if ( $show_image ) {
echo apply_filters( 'woocommerce_order_item_thumbnail', '<img src="' . ( $_product->get_image_id() ? current( wp_get_attachment_image_src( $_product->get_image_id(), 'thumbnail') ) : wc_placeholder_img_src() ) .'" alt="' . __( 'Product Image', 'email-control' ) . '" height="' . esc_attr( $image_size[1] ) . '" width="' . esc_attr( $image_size[0] ) . '" style="vertical-align:middle; margin-right: 10px;" />', $item );
}


I am trying to make this as a link to its product page such as the following:



<a href="<?php echo esc_url( get_permalink( $_product->id ) ); ?>">


However I am having a no luck. What would be the best way to modify the first code so that it can also get the product permalink?


Thanks





Aucun commentaire:

Enregistrer un commentaire