Ensure a valid order is found in order-details.php template

Closes #16049
This commit is contained in:
Mike Jolley 2017-07-11 11:10:40 +01:00
parent 5c32abfe6b
commit fb784930f6
1 changed files with 6 additions and 4 deletions

View File

@ -20,10 +20,12 @@ if ( ! defined( 'ABSPATH' ) ) {
exit;
}
$order = wc_get_order( $order_id );
$order_items = $order->get_items( apply_filters( 'woocommerce_purchase_order_item_types', 'line_item' ) );
$show_purchase_note = $order->has_status( apply_filters( 'woocommerce_purchase_note_order_statuses', array( 'completed', 'processing' ) ) );
$show_customer_details = is_user_logged_in() && $order->get_user_id() === get_current_user_id();
if ( ! $order = wc_get_order( $order_id ) ) {
return;
}
$order_items = $order->get_items( apply_filters( 'woocommerce_purchase_order_item_types', 'line_item' ) );
$show_purchase_note = $order->has_status( apply_filters( 'woocommerce_purchase_note_order_statuses', array( 'completed', 'processing' ) ) );
$show_customer_details = is_user_logged_in() && $order->get_user_id() === get_current_user_id();
?>
<section class="woocommerce-order-details">