Get Shipment data by order increment id Magento 2.

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

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

When you check the sales_shipment table, one field order_id is available in sales_shipment table so you first fetch the order id from the order increment id.

To get Shipment 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 ShipmentRepositoryInterface to fetch Shipment details by order increment id.

Using the above way you got the output as Shipment data by order increment id.

You need to pass increment_id of order to fetch shipment of orders.

Output:

The result will be no. of shipments generated for an Order.