Adding a new type of user address #4043
zernie
started this conversation in
New Features or Ideas
Replies: 2 comments 2 replies
-
That's an interesting situation. I don't think I've ever seen one add more kinds of addresses like that. |
Beta Was this translation helpful? Give feedback.
2 replies
-
Bill and Ship Addresses seem to have a lot of things in common. I'd be happy to review a PR where we try to generalize this concept, especially if this can be useful to create more address types as in your scenario. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently, there are two types of user addresses:
billing
andshipping
. For my marketplace (where users can own products) I'd like to add a new type, calledproduct
. However, it is hard to customize the logic because:Spree::UserAddressBook#save_in_address_book
needs to be overriden1.1 In here
solidus/core/app/models/concerns/spree/user_address_book.rb
Lines 122 to 126 in e878076
1.2. and in here
solidus/core/app/models/concerns/spree/user_address_book.rb
Line 113 in e878076
the problem with this line is that
user_addresses.mark_default
is defined only onuser_addresses
association:solidus/core/app/models/concerns/spree/user_address_book.rb
Lines 8 to 14 in e878076
not on
Spree::UserAddress
, so you'd need to add a new custom methodSpree::UserAddressBook#product_address=
needs to be added manuallySpree::UserAddressBook#product_address_attributes=
needs to be added manuallysolidus/core/app/models/concerns/spree/user_address_book.rb
Lines 160 to 164 in e878076
solidus/core/app/models/concerns/spree/user_address_book.rb
Lines 72 to 91 in e878076
needs to overriden
I might be missing something. But the point is: Could the logic of adding a new kind of address be generalized?
Beta Was this translation helpful? Give feedback.
All reactions