Get Website code by website id programmatically magento 2.

Retrieve website code by website id programmatically using Magento 2.

Many times, you have website id available but you have to fetch website code based on id, You need to use the StoreManagerInterface interface.

You can fetch current website code by below code snippet, Continue reading “Get Website code by website id programmatically magento 2.”

Get Credit memo details by order increment id Magento 2.

You can fetch the Credit memo collection details by Order Increment Id using Magento 2.

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

To get credit memo records, you first fetch the order id by order increment id and pass order id as SearchCriteriaBuilder addFilter() method. Continue reading “Get Credit memo details by order increment id Magento 2.”

Get Credit memo details by order id programmatically Magento 2.

You can get the Credit memo collection details for the specific order by an order id using Magento 2.

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

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