Merge pull request #4902 from thenbrent/master
Check product exists before accessing methods when sending order email
This commit is contained in:
commit
1f8d223ecc
|
@ -29,12 +29,12 @@ foreach ( $items as $item ) :
|
|||
echo apply_filters( 'woocommerce_order_item_name', $item['name'], $item );
|
||||
|
||||
// SKU
|
||||
if ( $show_sku && $_product->get_sku() ) {
|
||||
if ( $show_sku && is_object( $_product ) && $_product->get_sku() ) {
|
||||
echo ' (#' . $_product->get_sku() . ')';
|
||||
}
|
||||
|
||||
// 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 );
|
||||
$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>
|
||||
</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>
|
||||
<td colspan="3" style="text-align:left; vertical-align:middle; border: 1px solid #eee;"><?php echo apply_filters( 'the_content', $purchase_note ); ?></td>
|
||||
</tr>
|
||||
|
|
Loading…
Reference in New Issue