Commerce Order integration

Last updated on
21 August 2018

The module Commerce Inventory: Commerce Order is included as part of the Commerce Inventory project to support Commerce Order integration by default, but not require it. If it doesn't fully fulfill the needs of a project, it can be left disabled and used as an example of how to integrate with Commerce Inventory (or it can be enabled and extended).

Automatic inventory withholding and adjustment

This module enables the ability to automatically withhold inventory from the available count and adjust on-hand count based on Order status. To enable this functionality:

  1. Go to the Order Item Type's edit page (ex: /admin/commerce/config/order-item-types/default/edit)
  2. Find the Inventory Tracking fieldset
  3. Select a workflow (Default should be selected by default)
  4. Select workflow transitions based on when a workflow transition happens
    Suggested transitions:
    Place Order: Adjust Quantity Available
    Validate Order: None
    Fulfill Order: Adjust Quantity On-Hand
    Cancel Order: Untrack Quantity Adjustments

Inventory Allocation

This module sets up automatic Inventory Allocation based on Inventory location order on a store and the quantity of Inventory Items. If 5 of a Purchasable Entity are requested, with 3 in Location 1 and 6 in location 2, it will hold 3 from location 1 and then 2 from location 2. This will then track location 1 as 0 available and location 2 as 4 available. If the order is updated, previous quantity is tracked to ensure that if a location has inventory which is restocked, that stock takes precedence over location 2. 

Example allocation (with minimum count being used)

Before allocation:

Location On-Hand Available Minimum Unused
Location 1 3 2 0 2
Location 2 1 1 -4 5

After 5 items are allocated:

Location On-Hand Available Minimum Allocated Unused
Location 1 3 0 0 2 0
Location 2 1 0 -4 3 2

In the example above, a quantity of 2 are allocated from Location 1, which leaves 0 left to be used. Location 2 previously had 1 on-hand/available, but allowed for the minimum to be -4 (maybe they allow 4 to be on back-order), so the location effectively had 5 available to allocate. We allocated 1 from available, and 2 from the minimum which leaves 2 unused. Another order could allocate the remaining 2 before the Purchasable entity is listed as 0 available.

Help improve this page

Page status: No known problems

You can: