From 2e96982e609ecf249ce331020e8bb065d7db8dd3 Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Wed, 12 May 2021 16:34:00 +0100 Subject: [PATCH] Refactor conditional CartService#populate already returns the value of the #valid? method by default. --- app/controllers/cart_controller.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/controllers/cart_controller.rb b/app/controllers/cart_controller.rb index e35aedad28..8ea8d31ab0 100644 --- a/app/controllers/cart_controller.rb +++ b/app/controllers/cart_controller.rb @@ -3,11 +3,9 @@ class CartController < BaseController def populate order = current_order(true) - cart_service = CartService.new(order) - cart_service.populate(params.slice(:variants, :quantity)) - if cart_service.valid? + if cart_service.populate(params.slice(:variants, :quantity)) order.cap_quantity_at_stock! order.recreate_all_fees!