Sha256: ca9962644d5c344e4b693a39935f26c5312397e7974155d09019aca31bc02b54

Contents?: true

Size: 607 Bytes

Versions: 22

Compression:

Stored size: 607 Bytes

Contents

module Spree
  module Cart
    class RemoveLineItem
      prepend Spree::ServiceModule::Base

      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
        order.reload
        success(line_item)
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
spree_core-4.10.1 app/services/spree/cart/remove_line_item.rb
spree_core-4.10.0 app/services/spree/cart/remove_line_item.rb
spree_core-4.9.0 app/services/spree/cart/remove_line_item.rb
spree_core-4.8.3 app/services/spree/cart/remove_line_item.rb
spree_core-4.8.2 app/services/spree/cart/remove_line_item.rb
spree_core-4.7.3 app/services/spree/cart/remove_line_item.rb
spree_core-4.6.6 app/services/spree/cart/remove_line_item.rb
spree_core-4.5.5 app/services/spree/cart/remove_line_item.rb
spree_core-4.5.4 app/services/spree/cart/remove_line_item.rb
spree_core-4.6.5 app/services/spree/cart/remove_line_item.rb
spree_core-4.7.2 app/services/spree/cart/remove_line_item.rb
spree_core-4.7.1 app/services/spree/cart/remove_line_item.rb
spree_core-4.6.4 app/services/spree/cart/remove_line_item.rb
spree_core-4.7.0 app/services/spree/cart/remove_line_item.rb
spree_core-4.6.3 app/services/spree/cart/remove_line_item.rb
spree_core-4.6.2 app/services/spree/cart/remove_line_item.rb
spree_core-4.6.1 app/services/spree/cart/remove_line_item.rb
spree_core-4.6.0 app/services/spree/cart/remove_line_item.rb
spree_core-4.5.3 app/services/spree/cart/remove_line_item.rb
spree_core-4.5.2 app/services/spree/cart/remove_line_item.rb