Skip to content

Stock availability bug with multiple variants in assembly #162

@jkelleyj

Description

@jkelleyj

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

  • master
  • variant 1
    • part 1a
    • part 2a
  • variant 2
    • part 1b
    • part 2b

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions