Understand how Product availability and inventory maps to OpenAI fields.
All related fields are present within the ProductVariant type.
availability.channels is a key-value pair where the key is the Channel id and the value is a ProductVariantChannelAvailability. If the Channel does not exist, the values on variant.availability are used.| OpenAI Field | Related commercetools field | Required | Mapping Logic |
|---|---|---|---|
availability | availability.channels[channelId].isOnStock and variant.availability.isOnStock | Required | in_stock if isOnStock is true.out_of_stock if isOnStock is false and availability.channels[channelId].restockableInDays is undefined.preorder if isOnStock is false and availability.channels[channelId].restockableInDays is defined. Use out_of_stock if you do not allow preordering. |
inventory_quantity | availability.channels[channelId].availableQuantity and variant.availability.availableQuantity | Recommended | The amount of available inventory in stock. For example: 25. |