How to show source in shipment grid Magento 2 MSI

Hello Guys! Welcome back to another topic. Today I will show you how we can show supply source in shipment grid. With default Magento we can see Shipment number, Ship Date, Order, Order Date, Total Quantity etc. in shipment grid. To show the source of shipment we need to join inventory_shipment_source table to shipment grid…

Continue Reading How to show source in shipment grid Magento 2 MSI

How to Create Shipment Programmatically with MSI Magento 2

Hello Guys! Welcome back to my blog. There are many tutorials and stack Exchange answers available for programmatically create a shipment in Magento 2. But today in this article I'll talk about how we can programmatically create a shipment in multi stock inventory MSI in Magento 2. For MSI we need to assign a source…

Continue Reading How to Create Shipment Programmatically with MSI Magento 2

How to Add Custom Mass Action in Order Grid in Magento 2

Welcome back Magento Folks to my blog. In this article, I will show you how we can add new custom mass action to the order grid. The default Magento provides mass action like Cancel, Print, Delete, etc. We can easily add new mass action with UI components by two simple steps. Create sales_order_grid.xml in custom…

Continue Reading How to Add Custom Mass Action in Order Grid in Magento 2

How to get source by shipment Id in Magento 2 MSI

Hello guys! In this article, I will show you how we can get the assigned source of the order by shipment id. We can use the default Magento_InventoryShipping class Magento\InventoryShipping\Model\ResourceModel\ShipmentSource\GetSourceCodeByShipmentId Here is the sample code: <?php namespace Mageprince\Test\Model; use Magento\InventoryShipping\Model\ResourceModel\ShipmentSource\GetSourceCodeByShipmentId; class SampleClass { protected $filter; public function __construct( ... GetSourceCodeByShipmentId $sourceCodeByShipmentId, ... ) { $this->sourceCodeByShipmentId…

Continue Reading How to get source by shipment Id in Magento 2 MSI

A QUICK WAY to print log or data in any PHP file in Magento 2

Hello Magento Folks, Welcome back to my learning blog. Today in this article I'm gonna show you a quick way to print log or print data in any PHP file in Magento 2. Warning: Use this trick only for development local branches don't use this to any production or live stores. xdebug is the most…

Continue Reading A QUICK WAY to print log or data in any PHP file in Magento 2

How to get category by url key in Magento 2

Sometime during custom development, we need to get category by category key. Recently in one project, I had a task to show category URL key instead of category id on layered navigation. So I need to get category id from url key. So here was my way. Here is the sample code to get category…

Continue Reading How to get category by url key in Magento 2

Create short forms of Magento 2 commands in Linux

During development with Magento 2, we need to run the command repeatedly. And each time we need to type bin/magento command. In this article, I will show you how you can create short forms of Magento 2 commands in Linux. For example, you can clean the cache by only typing c:c without php bin/magento cache:clean…

Continue Reading Create short forms of Magento 2 commands in Linux

Get source by source code Multi Source Inventory(MSI) Magento 2

We can use Repository \Magento\InventoryApi\Api\SourceRepositoryInterface to get the source by code Here is the sample model class <?php namespace Mageprince\Testing\Model; class SourceModel { private $sourceRepository; public function __construct( ... \Magento\InventoryApi\Api\SourceRepositoryInterface $sourceRepository ... ) { $this->sourceRepository = $sourceRepository; } public function getSourcesByCode($sourceCode) { return $this->sourceRepository->get($storeCode); } } Now you can use getSourcesByCode() function to get the…

Continue Reading Get source by source code Multi Source Inventory(MSI) Magento 2