Delete Shipment by shipment id Magento 2.

You can delete the Specific Shipment data by shipment id in Magento 2.

Using Magento\Sales\Api\ShipmentRepositoryInterface interface, you need to use delete() method to delete shipment data from the shipment table.

You must first fetch the Shipment object by id and then pass the Shipment object as a parameter in delete() method to delete specific Shipment. Continue reading “Delete Shipment by shipment id Magento 2.”

Get Shipment data by shipment id Magento 2.

You can get the Shipment data for the specific shipment by shipment id in Magento 2.

Using Magento\Sales\Api\ShipmentRepositoryInterface interface, you need to use get() method to fetch shipment data by its id.

Pass shipment id as get method, get($shipmentId) arguments.

When you check the sales_shipment table, You can get the result of all the field value with a specific id. Continue reading “Get Shipment data by shipment id Magento 2.”

Get Invoice data by order increment id programmatically Magento 2.

You can get the invoice data for the specific order by order increment id in Magento 2.

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

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

To get invoice records, you first fetch the order id by order increment id and pass order id as SearchCriteriaBuilder addfilter() method. Continue reading “Get Invoice data by order increment id programmatically Magento 2.”