Forked from bekarice/woocommerce-updated-email-order-items-table.php
Created
April 3, 2016 16:07
-
-
Save monecchi/24c4b56631d5e14c1eefe4885a9e7320 to your computer and use it in GitHub Desktop.
WooCommerce Order Emails: Add product images to the order email (WooCommerce 2.5+)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // only copy this line if needed | |
/** | |
* Adds product images to the WooCommerce order emails table | |
* Uses WooCommerce 2.5 or newer | |
* | |
* @param string $output the buffered email order items content | |
* @param \WC_Order $order | |
* @return $output the updated output | |
*/ | |
function sww_add_images_woocommerce_emails( $output, $order ) { | |
// set a flag so we don't recursively call this filter | |
static $run = 0; | |
// if we've already run this filter, bail out | |
if ( $run ) { | |
return $output; | |
} | |
$args = array( | |
'show_image' => true, | |
'image_size' => array( 100, 100 ), | |
); | |
// increment our flag so we don't run again | |
$run++; | |
// if first run, give WooComm our updated table | |
return $order->email_order_items_table( $args ); | |
} | |
add_filter( 'woocommerce_email_order_items_table', 'sww_add_images_woocommerce_emails', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi! Where can i insert this code? Thank you?