$billing_email, ) ); } else { $wcOrders = get_posts( array( 'meta_key' => '_billing_email', 'meta_value' => $billing_email, 'post_type' => 'shop_order', ) ); } $historyOrders = array(); foreach ( $wcOrders as $wcOrder ) { $order_id = WC_Aplazame::_m_or_a( $wcOrder, 'get_id', 'id' ); $historyOrders[] = Aplazame_Aplazame_Api_BusinessModel_HistoricalOrder::createFromOrder( new WC_Order( $order_id ) ); } return Aplazame_Api_Router::success( Aplazame_Sdk_Serializer_JsonSerializer::serializeValue( $historyOrders ) ); } }