fix fatal error for non-existing products

Similar to #9363
This commit is contained in:
Spreeuw 2016-06-16 20:11:12 +02:00 committed by GitHub
parent 2019cdf108
commit 3ca95317fc
1 changed files with 2 additions and 1 deletions

View File

@ -272,8 +272,9 @@ class WC_Gateway_Paypal_Request {
$calculated_total += $item_line_total;
} else {
$product = $order->get_product_from_item( $item );
$sku = $product ? $product->get_sku() : '';
$item_line_total = $this->number_format( $order->get_item_subtotal( $item, false ), $order );
$line_item = $this->add_line_item( $this->get_order_item_name( $order, $item ), $item['qty'], $item_line_total, $product->get_sku() );
$line_item = $this->add_line_item( $this->get_order_item_name( $order, $item ), $item['qty'], $item_line_total, $sku );
$calculated_total += $item_line_total * $item['qty'];
}