Use of sales_quote_address_collect_totals_before events Magento 2.

You can use sales_quote_address_collect_totals_before event for setting your custom totals related data before Magento collect final totals for a quoted address.

Use of address collects totals before event inside observer, You can fetch specific quote data, shipping_assignment, and total related data for a cart. Continue reading “Use of sales_quote_address_collect_totals_before events Magento 2.”

Get Invoice details 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 details by order increment id programmatically Magento 2.”

Get Invoice details by order id programmatically Magento 2.

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

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

Using SearchCriteriaBuilder Class, You need to filter by order id and pass search criteria object to getList() method of InvoiceRepositoryInterface. Continue reading “Get Invoice details by order id programmatically Magento 2.”