support to change trackInventory for channel
choim4389 opened this issue · 5 comments
Is your feature request related to a problem? Please describe.
StockLevel can be set differently for each channel, but trackInventory can only be set globally, which is inconvenient.
For example, if you want to track inventory only in a specific store, there is currently no way to do so.
Describe the solution you'd like
To move trackInventory to stock_level from product_variant can be a solution, but I have no idea about side effects.
Describe alternatives you've considered
Additional context
This is actually implemented at the data-model level:
vendure/packages/core/src/entity/channel/channel.entity.ts
Lines 97 to 105 in bdf2329
It is just not currently used in the actual business logic. This means we can add support for this without requiring a breaking DB schema change.
I think there was some confusion with my question.
If you only use the channel's trackInventory, can't you still set it for each variant?
The way it will work in a future version will be like this:
global -> channel -> variant
So the trackInventory
can be set at those 3 levels.
- If set on the variant, that takes precedent
- Otherwise, it will use the setting for the given Channel
- Otherwise, it will use the global setting.
From what I understand, you are asking for something slightly different: that the trackInventory
is associated with a given StockLocation
. That's not something that can be supported by the current data model, but I can see how this may be a desirable feature to consider.
The way it will work in a future version will be like this:
global -> channel -> variant
So the
trackInventory
can be set at those 3 levels.
- If set on the variant, that takes precedent
- Otherwise, it will use the setting for the given Channel
- Otherwise, it will use the global setting.
If I understand correctly, variant is ChannelAware
. so, variant assigned to multiple channel will have multiple trackInventory
. is this right?
Yes, variants are channel aware. So in future, once the channel-level trackInventory
setting is actually being used, then yes. Currently that is not the case.