Skip to content

Commit

Permalink
Merge pull request #3548 from nebulab/kennyadsl/build-default-address
Browse files Browse the repository at this point in the history
Build default address with an existing method in checkout address
  • Loading branch information
aldesantis committed Mar 26, 2020
2 parents 16dc131 + 110641e commit c44e877
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions frontend/app/controllers/spree/checkout_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,8 @@ def before_address
@order.assign_default_user_addresses
# If the user has a default address, the previous method call takes care
# of setting that; but if he doesn't, we need to build an empty one here
default = { country_id: Spree::Country.default.id }
@order.build_bill_address(default) unless @order.bill_address
@order.build_ship_address(default) if @order.checkout_steps.include?('delivery') && !@order.ship_address
@order.bill_address ||= Spree::Address.build_default
@order.ship_address ||= Spree::Address.build_default if @order.checkout_steps.include?('delivery')
end

def before_delivery
Expand Down

0 comments on commit c44e877

Please sign in to comment.