Skip to content

Commit

Permalink
Remove LineItem#normalize_quantity callback
Browse files Browse the repository at this point in the history
This was mainly used for OrderContents#update_cart, but because the
method now deletes LineItems manually with quantities of 0 or less,
this is no longer needed.
  • Loading branch information
RyanofWoods committed Jul 21, 2023
1 parent ae87c41 commit f996063
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions core/app/models/spree/line_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class LineItem < Spree::Base
has_many :line_item_actions, dependent: :destroy
has_many :actions, through: :line_item_actions

before_validation :normalize_quantity
before_validation :set_required_attributes

validates :variant, presence: true
Expand Down Expand Up @@ -133,11 +132,6 @@ def pricing_options

private

# Sets the quantity to zero if it is nil or less than zero.
def normalize_quantity
self.quantity = 0 if quantity.nil? || quantity < 0
end

# Sets tax category, price-related attributes from
# its variant if they are nil and a variant is present.
def set_required_attributes
Expand Down

0 comments on commit f996063

Please sign in to comment.