Fix undefined $order_url variable

In the case of an order with no items.

Fix redundantly setting the $order_url multiple times in the case
of orders with more than one line item.
This commit is contained in:
Brent Shepherd 2017-03-02 13:09:38 -08:00
parent c76c2d1a8d
commit 759de5cc00
1 changed files with 1 additions and 1 deletions

View File

@ -334,6 +334,7 @@ class WC_Structured_Data {
$shop_name = get_bloginfo( 'name' ); $shop_name = get_bloginfo( 'name' );
$shop_url = home_url(); $shop_url = home_url();
$order_url = $sent_to_admin ? admin_url( 'post.php?post=' . absint( $order->get_id() ) . '&action=edit' ) : $order->get_view_order_url();
$order_statuses = array( $order_statuses = array(
'pending' => 'http://schema.org/OrderPaymentDue', 'pending' => 'http://schema.org/OrderPaymentDue',
'processing' => 'http://schema.org/OrderProcessing', 'processing' => 'http://schema.org/OrderProcessing',
@ -353,7 +354,6 @@ class WC_Structured_Data {
$product = apply_filters( 'woocommerce_order_item_product', $order->get_product_from_item( $item ), $item ); $product = apply_filters( 'woocommerce_order_item_product', $order->get_product_from_item( $item ), $item );
$product_exists = is_object( $product ); $product_exists = is_object( $product );
$is_visible = $product_exists && $product->is_visible(); $is_visible = $product_exists && $product->is_visible();
$order_url = $sent_to_admin ? admin_url( 'post.php?post=' . absint( $order->get_id() ) . '&action=edit' ) : $order->get_view_order_url();
$markup_offers[] = array( $markup_offers[] = array(
'@type' => 'Offer', '@type' => 'Offer',