How to create Shipment programmatically in magento 2?

We just need to pass order id in generateShipment($orderId) function from template.
below code snippet is used for generating Shipment in Magento 2, After generating Shipment automatically send the Shipment mail to a customer who has placed the order.

Call function from the template,

Now Check from Admin panel.

Sales -> Order, Order with Id 1 has generated Shipment.

Leave a Reply

Your email address will not be published. Required fields are marked *