Merge pull request #4902 from thenbrent/master

Check product exists before accessing methods when sending order email
This commit is contained in:
Coen Jacobs 2014-02-22 12:57:48 +01:00
commit 1f8d223ecc
1 changed files with 3 additions and 3 deletions

View File

@ -29,12 +29,12 @@ foreach ( $items as $item ) :
echo apply_filters( 'woocommerce_order_item_name', $item['name'], $item ); echo apply_filters( 'woocommerce_order_item_name', $item['name'], $item );
// SKU // SKU
if ( $show_sku && $_product->get_sku() ) { if ( $show_sku && is_object( $_product ) && $_product->get_sku() ) {
echo ' (#' . $_product->get_sku() . ')'; echo ' (#' . $_product->get_sku() . ')';
} }
// File URLs // File URLs
if ( $show_download_links && $_product->exists() && $_product->is_downloadable() ) { if ( $show_download_links && is_object( $_product ) && $_product->exists() && $_product->is_downloadable() ) {
$download_files = $order->get_item_downloads( $item ); $download_files = $order->get_item_downloads( $item );
$i = 0; $i = 0;
@ -62,7 +62,7 @@ foreach ( $items as $item ) :
<td style="text-align:left; vertical-align:middle; border: 1px solid #eee;"><?php echo $order->get_formatted_line_subtotal( $item ); ?></td> <td style="text-align:left; vertical-align:middle; border: 1px solid #eee;"><?php echo $order->get_formatted_line_subtotal( $item ); ?></td>
</tr> </tr>
<?php if ( $show_purchase_note && $purchase_note = get_post_meta( $_product->id, '_purchase_note', true ) ) : ?> <?php if ( $show_purchase_note && is_object( $_product ) && $purchase_note = get_post_meta( $_product->id, '_purchase_note', true ) ) : ?>
<tr> <tr>
<td colspan="3" style="text-align:left; vertical-align:middle; border: 1px solid #eee;"><?php echo apply_filters( 'the_content', $purchase_note ); ?></td> <td colspan="3" style="text-align:left; vertical-align:middle; border: 1px solid #eee;"><?php echo apply_filters( 'the_content', $purchase_note ); ?></td>
</tr> </tr>