Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

yeonhoyoon
Copy link
Contributor

Set bill_address to default address, if user has one.

Currently when an order goes to address state, only ship_address gets filled in from a previously entered address. This is 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.

@@ -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)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing whitespace detected.

@yeonhoyoon yeonhoyoon changed the title set billing address to default address Set billing address to default address Mar 1, 2016
@jgujgu
Copy link

jgujgu commented Mar 8, 2016

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.

jgujgu added a commit to jgujgu/callisto that referenced this pull request Mar 8, 2016
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.
@yeonhoyoon
Copy link
Contributor Author

😎

@mamhoff
Copy link
Contributor

mamhoff commented Mar 31, 2016

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.
@yeonhoyoon
Copy link
Contributor Author

@mamhoff sure, squashed them.

@mamhoff
Copy link
Contributor

mamhoff commented Apr 19, 2016

👍

@tvdeyen
Copy link
Member

tvdeyen commented Apr 19, 2016

Thanks! I would love to see tests for this

@mamhoff
Copy link
Contributor

mamhoff commented May 25, 2016

@yeonhoyoon This is good to go, except it needs some specs.

@tvdeyen
Copy link
Member

tvdeyen commented Jun 13, 2017

Closing as stale. Please reopen if you think this is still something we should to tackle.

@tvdeyen tvdeyen closed this Jun 13, 2017
peterberkenbosch pushed a commit to peterberkenbosch/solidus that referenced this pull request Jun 20, 2017
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants