-
-
Save Kenshino/c7b81836ca907621e78251a96ef1d70f to your computer and use it in GitHub Desktop.
version of email_order_items_table for use outside of the class
This file contains hidden or 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 | |
$return = ''; | |
foreach( $order->get_items() as $item ) : | |
$_product = $order->get_product_from_item( $item ); | |
$file = $sku = $variation = $image = ''; | |
$src = wp_get_attachment_image_src( get_post_thumbnail_id( $_product->id ), 'thumbnail'); | |
$image = apply_filters('woocommerce_order_product_image', '<img src="'.$src[0].'" alt="Product Image" height="100" width="100" style="vertical-align:middle; margin-right: 10px;" />', $_product); | |
$item_meta = new WC_Order_Item_Meta( $item, $_product ); | |
$variation = '<br/><small>' . $item_meta->display( true, true ). '</small>'; | |
$return .= '<tr> | |
<td style="text-align:left; vertical-align:middle; border: 1px solid #eee;">'. $image . apply_filters('woocommerce_order_product_title', $item['name'], $_product) . $variation . '</td> | |
<td style="text-align:left; vertical-align:middle; border: 1px solid #eee;">' . $item['qty'] .'</td> | |
</tr>'; | |
// Show any purchase notes | |
if ($purchase_note = get_post_meta( $_product->id, '_purchase_note', true )) : | |
$return .= '<tr><td colspan="3" style="text-align:left; vertical-align:middle; border: 1px solid #eee;">' . apply_filters('the_content', $purchase_note) . '</td></tr>'; | |
endif; | |
endforeach; | |
echo $return; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment