mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-30 21:27:17 +00:00
Overring before_address to conform to our new checkout as necessary
This commit is contained in:
@@ -63,6 +63,14 @@ class Shop::CheckoutController < Spree::CheckoutController
|
||||
state_callback(:before)
|
||||
end
|
||||
|
||||
def before_address
|
||||
associate_user
|
||||
last_used_bill_address, last_used_ship_address = find_last_used_addresses(@order.email)
|
||||
preferred_bill_address, preferred_ship_address = spree_current_user.bill_address, spree_current_user.ship_address if spree_current_user.respond_to?(:bill_address) && spree_current_user.respond_to?(:ship_address)
|
||||
@order.bill_address ||= preferred_bill_address || last_used_bill_address || Spree::Address.default
|
||||
@order.ship_address ||= preferred_ship_address || last_used_ship_address || Spree::Address.default
|
||||
end
|
||||
|
||||
# Overriding Spree's methods
|
||||
def raise_insufficient_quantity
|
||||
flash[:error] = t(:spree_inventory_error_flash_for_insufficient_quantity)
|
||||
|
||||
Reference in New Issue
Block a user