0

Magento2 MSI How can we set 1 source to ship from, but not to sale from?

We currently use backorders. Sales are made from stock sources and backorders (min_qty).

Suppose

  • Local stock 2
  • Incoming stock 0
  • Backorder Min Qty -1
  • Customer orders 3 utilizing stock and all backorders

This order cannot be shipped because it needs 3 but only has access to 2.

The backorder is then processed and backordered at the suppliers. Then stock is received and scanned and updates the INC Incoming source with +1. We then go to shipment

The only problem here is that when Incoming stock is scanned and updated to +1 that the salable qty is adjusted and that a customer can order this item in he frontend. So as a result : you would want to have a source that does not affect the salable qty, but is however available for shipping in the backend.

Question: how can we setup a source that can be used as a source for shipping but ont for sale?

0

As you may know, a stock salable quantity equals the sum of all stock source quantities minus reserved quantity and minus min quantity (Out-of-Stock Threshold). See

\Magento\InventorySales\Model\GetProductSalableQty::execute

The most logical way to solve the problem is to reserve all "Incoming stock" (INC source) items. Once INC source quantity is changed for some SKU, an appropriate reservation must be created/updated. See inventory_reservation table. Your reservation metadata can be {"event_type":"incoming_source_qty_updated","object_type":"product","object_id":"1"}

Reference \Magento\InventorySales\Model\PlaceReservationsForSalesEvent::execute as an example of how reservation can be created.

2
  • Interesting. Just for completeness there is no way to make a source not visible on the front end (for sales) but it can be used for shipments? (Without using the above)
    – snh_nl
    Jul 1 '20 at 6:44
  • Secondly. We use backorders - so this would mean we would have to remove 1 backorder reservation and replace it by and INC reservation. But Magento does not store the source in reservations. So the effect would be null? Or is the suggestion above to reserve every item you import to the INC source no matter what? Suppose we have some products that are remains ... how could we then release it again and move it to another source (where it should not be reserved)
    – snh_nl
    Jul 1 '20 at 6:46
0

I am wondering whether you can't make the "stock status" for that product for that source to be "not in stock" temporarily - that should mean the stock is not available to sell, even though it exists.

As in - when a shipment has arrived and is put into your stock, put the stock status for the new arrived products in that stock source to 0.

Process the pending orders

When done, change the status for those products for that source to 1

Only then will they be available on the site.

This should buy you the breathing space you want.

1
  • Thx. I think setting the product to out of stock not only disables sale from the front end (this we want) but also does not allow it to be used for shipping. If this last step was possible the this could be a solution
    – snh_nl
    Jul 1 '20 at 20:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.