I need to filter order collection based on payment method. I tried the following:
$customerOrderCollection = $this->orderCollectionFactory->create()->addFieldToFilter('customer_id', $customerId) ->addFieldToFilter('status', 'pending'); /* join with payment table */ $customerOrders = $customerOrderCollection->getSelect() ->join(["sop" => "sales_order_payment"], 'main_table.entity_id = sop.parent_id', array('method') ) ->where('sop.method = ?',$paymentMethod );
But I am not able to apply getData() method on the above collection. I need to check if at least a single order exists based on above conditions
Is there a way to join collection and also get data?