mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Use OrderContents when removing line items with soft-deleted variants in CartService
This commit is contained in:
@@ -37,7 +37,7 @@ class CartService
|
||||
loaded_variant = loaded_variants[variant_data[:variant_id].to_i]
|
||||
|
||||
if loaded_variant.deleted?
|
||||
remove_deleted_variant(loaded_variant)
|
||||
order.contents.remove(loaded_variant)
|
||||
next
|
||||
end
|
||||
|
||||
@@ -57,10 +57,6 @@ class CartService
|
||||
end
|
||||
end
|
||||
|
||||
def remove_deleted_variant(variant)
|
||||
line_item_for_variant(variant).andand.destroy
|
||||
end
|
||||
|
||||
def attempt_cart_add(variant, quantity, max_quantity = nil)
|
||||
quantity = quantity.to_i
|
||||
max_quantity = max_quantity.to_i if max_quantity
|
||||
|
||||
Reference in New Issue
Block a user