Skip to content

Commit

Permalink
Remove deprecated Spree::Order#require_email
Browse files Browse the repository at this point in the history
Please, use Spree::Order#email_required? now.

Ref solidusio#3879
  • Loading branch information
kennyadsl committed Mar 21, 2023
1 parent 7872fa5 commit 0b5c5bc
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions core/app/models/spree/order.rb
Original file line number Diff line number Diff line change
Expand Up @@ -767,16 +767,17 @@ def link_by_email
self.email = user.email if user
end

# Determine if email is required (we don't want validation errors before we hit the checkout)
# Determine if the email is required for this order
#
# We don't require email for orders in the cart state or address state because those states
# precede the entry of an email address.
#
# @return [Boolean] true if the email is required
# @note This method was called require_email before.
def email_required?
true unless new_record? || ['cart', 'address'].include?(state)
end

def require_email
Spree::Deprecation.warn "Use email_required? instead", caller(1)
email_required?
end

def ensure_inventory_units
if has_checkout_step?("delivery")
inventory_validator = Spree::Config.stock.inventory_validator_class.new
Expand Down

0 comments on commit 0b5c5bc

Please sign in to comment.