-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set billing address to default address #942
Conversation
@@ -295,11 +295,14 @@ def ship_address_attributes=(attributes) | |||
|
|||
def assign_default_addresses! | |||
if user | |||
bill_address = (user.bill_address || user.default_address) | |||
ship_address = (user.ship_address || user.default_address) | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected.
Great catch...I was going to figure out a good way to do this myself, except less good. When I am beaten to the punch, it is usually because of another Asian guy in glasses. |
One open PR removes the problem I was having with the default billing address not being prefilled. solidusio/solidus#942 I will remove this file once the PR is merged.
😎 |
This is 👍 by me. However, would you care to merge the second (fixup) commit into the first one? |
Set `bill_address` to default address, if user has one. Currently when order goes to `address` state, only ship address gets filled in from a previously entered address. This is because `ship_address` is set to default address because `ship_address` is an alias for `default_address` in the `UserAddressBook` module. https://github.com/solidusio/solidus/blob/master/core/app/models/concerns/spree/user_address_book.rb#L53 However bill_address is not an alias, so it is not prefilled and user has to enter it every time. Rather than making it into an alias, just try default_address in `assign_default_address` if user has one.
@mamhoff sure, squashed them. |
👍 |
Thanks! I would love to see tests for this |
@yeonhoyoon This is good to go, except it needs some specs. |
Closing as stale. Please reopen if you think this is still something we should to tackle. |
update for solidusio#942 including specs changes. The PR stalled, cherry-picked the commit and updated the spec suite to reflect the changes. Closes solidusio#942
Set
bill_address
to default address, if user has one.Currently when an order goes to
address
state, onlyship_address
gets filled in from a previously entered address. This is becauseship_address
is an alias fordefault_address
in theUserAddressBook
module.https://github.com/solidusio/solidus/blob/master/core/app/models/concerns/spree/user_address_book.rb#L53
However,
bill_address
is not an alias, so it is not prefilled and user has to enter it every time. Rather than making it into an alias, just try default_address inassign_default_address!
if user has one.