Get Current Website code programmatically magento 2.

We can get Current website code programmatically using Magento 2 by StoreManagerInterface.

By default, Single website have default assigned code is “default”

If you are working with multiple website eCommerce stores, You need to fetch current website code for respected website programmatically on some occasion.

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.

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.