From 9fd126ca0fb4b1ffd849e39fb201b3904b428298 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bellet Date: Mon, 23 Aug 2021 15:42:29 +0200 Subject: [PATCH] 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. --- app/controllers/split_checkout_controller.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/controllers/split_checkout_controller.rb b/app/controllers/split_checkout_controller.rb index 7a77c74e0b..febe9ebf30 100644 --- a/app/controllers/split_checkout_controller.rb +++ b/app/controllers/split_checkout_controller.rb @@ -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"