parent
815a627edf
commit
a092fce0c2
|
@ -396,11 +396,13 @@ class WC_API_Reports extends WC_API_Resource {
|
|||
|
||||
$product = wc_get_product( $top_seller->product_id );
|
||||
|
||||
$top_sellers_data[] = array(
|
||||
'title' => $product->get_title(),
|
||||
'product_id' => $top_seller->product_id,
|
||||
'quantity' => $top_seller->order_item_qty,
|
||||
);
|
||||
if ( $product ) {
|
||||
$top_sellers_data[] = array(
|
||||
'title' => $product->get_title(),
|
||||
'product_id' => $top_seller->product_id,
|
||||
'quantity' => $top_seller->order_item_qty,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return array( 'top_sellers' => apply_filters( 'woocommerce_api_report_response', $top_sellers_data, $this->report, $fields, $this->server ) );
|
||||
|
|
Loading…
Reference in New Issue