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

Order Consolidation: “Address does not belong to Customer” #433

Closed
AugustMiller opened this issue Aug 2, 2018 · 1 comment
Closed
Labels

Comments

@AugustMiller
Copy link
Contributor

I've imported a number of orders, as though they were made by guests.

Once a customer creates an account on-site, we want to consolidate any prior orders into their new user-connected customer.

The consolidation process runs, but bails because the new customers/users doesn't own the addresses.

Is there a recommended method for allowing addresses to be discovered/fetched from an order, which has been completed (and for which the associated addresses are copied into a kind of hidden/disassociated state)?

@AugustMiller
Copy link
Contributor Author

AugustMiller commented Aug 2, 2018

This looks like an issue with validating the order, after it's been completed… is that necessary?

For reference, disabling element validation when the order is re-saved allows the “non-owned” addresses to be preserved:

https://github.com/craftcms/commerce/blob/develop/src/services/Customers.php#L317

AugustMiller added a commit to AugustMiller/commerce that referenced this issue Aug 20, 2018
This is a potential fix for craftcms#413 and craftcms#433.

It prevents normal ownership validation on orders that have been marked as `isCompleted`, and doesn't attempt to re-save addresses as belonging to an order's customer, when an order is updated for any other reason, after completion.
@lukeholder lukeholder added the bug label Aug 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants