mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-15 23:57:48 +00:00
The ship address is filled from bill address for some attributes
firstname, lastname and phone are the same between those two address. Fill it automatically.
This commit is contained in:
@@ -52,6 +52,7 @@ class SplitCheckoutController < ::BaseController
|
||||
def handle_shipping_method_selection
|
||||
load_shipping_method
|
||||
filter_ship_address_params
|
||||
populate_ship_address_common_params
|
||||
populate_ship_address_params
|
||||
@shipping_method_id = params[:shipping_method_id]
|
||||
@ship_address_same_as_billing = params[:order]["Checkout.ship_address_same_as_billing"]
|
||||
@@ -68,6 +69,12 @@ class SplitCheckoutController < ::BaseController
|
||||
params[:order].delete(:ship_address_attributes)
|
||||
end
|
||||
|
||||
def populate_ship_address_common_params
|
||||
params[:order][:ship_address_attributes][:firstname] = params[:order][:bill_address_attributes][:firstname]
|
||||
params[:order][:ship_address_attributes][:lastname] = params[:order][:bill_address_attributes][:lastname]
|
||||
params[:order][:ship_address_attributes][:phone] = params[:order][:bill_address_attributes][:phone]
|
||||
end
|
||||
|
||||
def populate_ship_address_params
|
||||
return unless params[:order]["Checkout.ship_address_same_as_billing"] == "1"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user