From 6451ef173c5b9e9ca73f6d57090bd784e0c6b09c Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Tue, 11 May 2021 13:39:53 +0100 Subject: [PATCH] Use OrderContents when removing line items with soft-deleted variants in CartService --- app/services/cart_service.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/app/services/cart_service.rb b/app/services/cart_service.rb index 029541f740..cc752542df 100644 --- a/app/services/cart_service.rb +++ b/app/services/cart_service.rb @@ -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