Class: SolidusFriendlyPromotions::SimpleOrderContents

Inherits:
Spree::OrderContents
  • Object
show all
Defined in:
app/models/solidus_friendly_promotions/simple_order_contents.rb

Instance Method Summary collapse

Instance Method Details

#update_cart(params) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/models/solidus_friendly_promotions/simple_order_contents.rb', line 5

def update_cart(params)
  if order.update(params)
    unless order.completed?
      order.line_items = order.line_items.select { |li| li.quantity > 0 }
      order.check_shipments_and_restart_checkout
    end
    reload_totals
    true
  else
    false
  end
end