Swap billing/shipping address in the address step
We currently use a non-common use case and we should swap the addresses which is the most common use case.
@kennyadsl @ChristianRimondi @blocknotes we should discuss if this is an issue with Solidus and if it should be addressed there. Otherwise, treating it inside this gem requires the Order model decoration.
What's the change needed in the Order model?
module SwapAddressForms
def self.prepended(base)
base.before_validation :assign_shipping_to_billing_address, if: :use_shipping?
attr_accessor :use_shipping
end
def assign_shipping_to_billing_address
self.bill_address = ship_address if ship_address
true
end
def use_shipping?
use_shipping.in?([true, 'true', '1'])
end
Spree::Order.prepend self
end
end
👍 thanks, let's think of a way to add support for this in core.
I had an idea here: in Solidus core, we could change the preference name from use_shipping to same_shipping_and_billing and allow this accessor to be set on both billing and shipping address, this way we could just let user's frontends to choose where to put that checkbox and adapt the backend core to work accordingly.
This issue has been automatically marked as stale because it has not had recent activity. It might be closed if no further activity occurs. Thank you for your contributions.