Extract method

This commit is contained in:
Matt-Yorkley
2021-05-11 10:34:06 +01:00
parent c55e47f6af
commit 1268cb565c

View File

@@ -33,7 +33,7 @@ module Spree
def update_cart(params)
if order.update_attributes(params)
order.line_items = order.line_items.select {|li| li.quantity > 0 }
discard_empty_line_items
order.ensure_updated_shipments
update_order
true
@@ -44,6 +44,10 @@ module Spree
private
def discard_empty_line_items
order.line_items = order.line_items.select {|li| li.quantity.positive? }
end
def update_shipment(shipment)
shipment.present? ? shipment.update_amounts : order.ensure_updated_shipments
end