spree-contrib / spree-product-assembly

Adds ability to make product bundles
https://spreecommerce.org
BSD 3-Clause "New" or "Revised" License
97 stars 187 forks source link

Stock availability bug with multiple variants in assembly #162

Open jkelleyj opened 7 years ago

jkelleyj commented 7 years ago

When more than one variant is used on an assembly product, if any one of the variants has an out of stock part, no variant can be added to the cart because the availability validator uses quantity_without_part_line_items on the line item to get the parts. This pulls all parts on the product as opposed to the variant specified.

For example: Assembly Product

Whenever part 2b is OOS, variant 1 can not be added to the cart. It happens to work if one is already in the cart, b/c quantity_with_part_line_items is used in the availability validator in that case. But when the item is added the first time, it fails due to a stock error in the line item validation.

We can change the quantity_without_part_line_items method to use the chosen assembly variant's parts (this works for master when no variants as well as an assembly variant).

czottmann commented 6 years ago

+1

kinduff commented 6 years ago

+1