Class: Spree::Cart::RemoveLineItem

Inherits:
Object
  • Object
show all
Includes:
ServiceModule::Base
Defined in:
app/services/spree/cart/remove_line_item.rb

Instance Method Summary collapse

Methods included from ServiceModule::Base

prepended

Instance Method Details

#call(order:, line_item:, options: nil) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'app/services/spree/cart/remove_line_item.rb', line 6

def call(order:, line_item:, options: nil)
  options ||= {}
  ActiveRecord::Base.transaction do
    line_item.destroy!
    Spree::Dependencies.cart_recalculate_service.constantize.new.call(order: order,
                                                                      line_item: line_item,
                                                                      options: options)
  end
  success(line_item)
end