QuestionQ7

Design and implement optimal solutions for Adobe Commerce to meet business needs

A client operates multiple warehouses from which orders can be fulfilled. The shipping cost from each warehouse changes daily because the number of available workers varies. The Architect must ensure that an order is shipped from the open warehouse with the lowest cost.

How should this functionality be implemented?

  • A Create a new class as a preference for Magento\InventoryShipping\Plugin\Sales\Shipment\AssignSourceCodeToShipmentPlugin to set the lowest-cost warehouse on a shipment.
  • B Create a new class implementing Magento\InventorySourceSelectionApi\Model\SourceSelectionInterface, which returns open warehouses sorted by cost.
  • C Create an after plugin on Magento\InventoryDistanceBasedSourceSelection\Model\Algorithms\DistanceBasedAlgorithm to sort Warehouse sources by cost.
Explanation

Magento Multi-Source Inventory supports custom Source Selection Algorithms through Magento\InventorySourceSelectionApi\Model\SourceSelectionInterface. A custom implementation can evaluate each source’s current availability and shipping cost, exclude closed warehouses, and return the source-selection result that fulfills the shipment at the lowest cost. Adobe Commerce specifically documents this interface as the extension point for custom source-selection methods, including a minimal-delivery-cost algorithm.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!