You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently this code in the availability validator assumes that the inventory units on the line item have the same variant as the line item does. This is true on stock stores, but we provide extension points to break that assumption.
I don't think it's necessary to assume the variants are the same. The assumption creates extra work for anyone doing something like "packs" or solidus_product_assembly. We could replace that code with something that uses the variants from the inventory units and save extensions/individual stores from making that customization.
I've provided some unrefactored code below that we could use. Replacing the lines I linked above with this (hopefully after refactoring, as this is pretty gnarly) would maintain the existing functionality for stock stores where the line item variant and inventory unit variants always match, and allow us to delete customizations from solidus_product_assembly (and other stores that I work on.) I wouldn't consider this a breaking change, either.
Edit: I've also found that work has been done to support use cases for this kind of thing elsewhere. solidus_product_assembly contains an unnecessarily complex* override to handle inventory unit finalization (specifically unstocking the correct variant.) This seemingly works around an issue that was fixed when @AlessioRocco made the inventory unit finalizer respect the inventory unit variants here.
*I'm calling that unnecessarily complex because I'm pretty sure what Alessio did is simpler and will work just as well without knowing anything about product assemblies.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Currently this code in the availability validator assumes that the inventory units on the line item have the same variant as the line item does. This is true on stock stores, but we provide extension points to break that assumption.
I don't think it's necessary to assume the variants are the same. The assumption creates extra work for anyone doing something like "packs" or
solidus_product_assembly
. We could replace that code with something that uses the variants from the inventory units and save extensions/individual stores from making that customization.I've provided some unrefactored code below that we could use. Replacing the lines I linked above with this (hopefully after refactoring, as this is pretty gnarly) would maintain the existing functionality for stock stores where the line item variant and inventory unit variants always match, and allow us to delete customizations from
solidus_product_assembly
(and other stores that I work on.) I wouldn't consider this a breaking change, either.Again, this code isn't refactored.
Edit: I've also found that work has been done to support use cases for this kind of thing elsewhere.
solidus_product_assembly
contains an unnecessarily complex* override to handle inventory unit finalization (specifically unstocking the correct variant.) This seemingly works around an issue that was fixed when @AlessioRocco made the inventory unit finalizer respect the inventory unit variants here.*I'm calling that unnecessarily complex because I'm pretty sure what Alessio did is simpler and will work just as well without knowing anything about product assemblies.
Beta Was this translation helpful? Give feedback.
All reactions