Get Shipment collection details by order id Magento 2.

You can get the Shipment data or collection for the specific order by order id in Magento 2.

Using Magento\Sales\Api\ShipmentRepositoryInterface interface, you need to use getList() function to fetch no. of Shipment by sales order id.

Using SearchCriteriaBuilder Class, You need to use addFilter() method, filter by order id and pass searchCriteria object to getList() method of ShipmentRepositoryInterface.

Using the above way you got the output as Shipment records as an array and iterate over a loop to Shipment array to fetch no. of different Shipment record for an order.

Output: