Get Credit memo details by order increment id Magento 2.

You can fetch the Credit memo collection details by Order Increment Id using Magento 2.

When you check the sales_creditmemo table, order_id available in sales_creditmemo table so you first fetch the order entity id from the order increment id.

To get credit memo records, you first fetch the order id by order increment id and pass order id as SearchCriteriaBuilder addFilter() method.

Pass search criteria object to getList() method of CreditmemoRepositoryInterface to fetch credit memo details by order increment id.

Using the above way you got the output as credit memo records as an array.

Iterate over a loop to credit memo array to fetch no. of different credit memo record for an order.

You got the credit memo object for the output of the above code.