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

Support Default Billing Address in Address Book #3539

Closed
ericsaupe opened this issue Mar 5, 2020 · 3 comments
Closed

Support Default Billing Address in Address Book #3539

ericsaupe opened this issue Mar 5, 2020 · 3 comments
Labels
type:enhancement Proposed or newly added feature

Comments

@ericsaupe
Copy link
Contributor

Is your feature request related to a problem? Please describe.

Currently, persist_order_address saves order addresses to a user's address book via save_in_address_book that also supports the Spree::Config.automatic_default_address config setting. Unfortunately, this does not work for billing_address because that is still being pulled from a column on the spree_users table whereas shipping_address is pulled from the spree_user_addresses where default is true. This means that even if your config is set to automatic_default_address = false it will still set the default billing address on every order save.

Describe the solution you'd like

Support Spree::UserAddress to work for both billing and shipping addresses. Maybe add columns for default_billing and default_shipping while leaving the default column.

Describe alternatives you've considered

Changing the setting of self.bill_address_id to respect Spree::Config.automatic_default_address

# solidus/core/app/models/concerns/spree/user_address_book.rb:79-86
    if order.bill_address
      address = save_in_address_book(
        order.bill_address.attributes,
        order.ship_address.nil? && Spree::Config.automatic_default_address
      )
      # Respect automatic_default_address on legacy bill_address_id field
      self.bill_address_id = address.id if address && address.persisted? && Spree::Config.automatic_default_address
    end

Additional context

@aldesantis
Copy link
Member

I agree that we should standardize this as the current behavior doesn't make much sense, and I think having a default_billing and default_shipping would work well here.

@kennyadsl kennyadsl added type:enhancement Proposed or newly added feature Good First Issue labels Mar 10, 2020
@gonzar11
Copy link

anyone working on this issue? If not I would like to grab it!

@kennyadsl
Copy link
Member

@gonzar11 thanks, @oldjackson is working on that in #3563.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:enhancement Proposed or newly added feature
Projects
None yet
Development

No branches or pull requests

4 participants