woocommerce_order_item_thumbnail

The WooCommerce woocommerce order item thumbnail hook.

Description

apply_filters( 'woocommerce_order_item_thumbnail', (string) $var, (unknown) $item ); 

Parameters (2)

0. $var — Optional. (string) => '
' . esc_attr__( 'Product image', 'woocommerce' ) . '
'
The div style margin bottom 5px img src product get image id current wp get attachment image src product get image id thumbnail wc placeholder img src alt esc attr product image woocommerce height esc attr image size 1 width esc attr image size 0 style vertical align middle margin is rtl left right 10px div.
1. $item (unknown)
The item.

Usage

To run the hook, copy the example below.
  1. $var = apply_filters( 'woocommerce_order_item_thumbnail', $var, $item ); 
  2.  
  3. if ( !empty( $var ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the woocommerce_order_item_thumbnail callback 
  2. function filter_woocommerce_order_item_thumbnail( $var, $item ) { 
  3. // make filter magic happen here... 
  4. return $var
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'woocommerce_order_item_thumbnail', 'filter_woocommerce_order_item_thumbnail', 10, 2 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'woocommerce_order_item_thumbnail', 'filter_woocommerce_order_item_thumbnail', 10, 2 ); 

Defined (1)

The filter is defined in the following location(s).

/templates/emails/email-order-items.php  
  1. echo apply_filters( 'woocommerce_order_item_thumbnail', '<div style="margin-bottom: 5px"><img src="' . ( $product->get_image_id() ? current( wp_get_attachment_image_src( $product->get_image_id(), 'thumbnail' ) ) : wc_placeholder_img_src() ) . '" alt="' . esc_attr__( 'Product image', 'woocommerce' ) . '" height="' . esc_attr( $image_size[1] ) . '" width="' . esc_attr( $image_size[0] ) . '" style="vertical-align:middle; margin-' . ( is_rtl() ? 'left' : 'right' ) . ': 10px;" /></div>', $item );