That is very strange, warehouse can only be deactivated by WarehouseService. Is it consistent or randomly?
It looks very random. Some customers experience this behavior and cannot purchase the items, while others can. Only thing I can think of is that we run inventory sync between the ERP-system and Commerce at given times. But during daytime it's partial and only runs for a few seconds. I don't see any coherence between the sync and the error.
Our setup contains several warehouses that are active, but they are site based (we are running multiple sites on one server), so that one site uses only one warehouse.
Did you check if the warehouse is actually inactive? Because the error can be returned if the warehouse assigned to the shipment does not exist. Make sure IShipment.WarehouseCode is set to the correct one.
And we have an answer. The warehouse for the shipment is wrong. It is set to "default" which is of course the default warehouse. This warehouse has been deactivated.
I guess you asked on how to control which warehouse is selected. You can always implement IFulfillmentWarehouseProcessor and decide which warehouse would you want to choose for a shipment.
We are experiencing some problems related to a warehouse in our Episerver Commerce-site. At times the warehouse becomes inactive, seen by the call to AdjustInventoryOrRemoveLineItems which gives the validation issue "RemovedDueToInactiveWarehouse". The strange thing is that just before this call we verify the inventory by using the UpdateInventoryOrRemoveLineItems-method, which doesn't give any verification issues.
Has anybody else seen this behavior?