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

Persist makePrimaryShippingAddress and makePrimaryBillingAddress on carts #3864

Merged
merged 4 commits into from
Jan 29, 2025

Conversation

lukeholder
Copy link
Member

@lukeholder lukeholder commented Jan 28, 2025

Description

When choosing addresses from a customer's address book to use as the addresses on the cart, billingAddressId or shippingAddressId are submitted.

Optionally, you can also pass makePrimaryShippingAddress or makePrimaryBillingAddress, which allows the customer to make these submitted addresses the new primary addresses in their address book.

Alternatively, instead of submitting address IDs from the address book, the customer can submit a new address directly to the cart. This address would only exist on the order and would not be added to the address book, even after checkout. However, customers requested the ability to collect a new address and have it added to the address book after checkout.

To address this, we introduced cart parameters called saveBillingAddressOnOrderComplete and saveShippingAddressOnOrderComplete. These parameters can be added to the cart so that, when the order is completed, the addresses on the order are copied to the customer's address book.

The issue this PR fixes is related to the behavior of copying these addresses to the address book. Now, when this copy occurs, we will check the makePrimaryShippingAddress or makePrimaryBillingAddress flags to determine whether the copied addresses should become the primary addresses in the address book. Previously, these flags only worked when selecting an existing address from the address book.

The makePrimaryShippingAddress or makePrimaryBillingAddress were previously never persisted to the order record but they are now in this PR. This means during checkout the developer can know the customers selection during checkout (since previously they only existed as options within a single cart update request).

@lukeholder lukeholder requested a review from a team as a code owner January 28, 2025 12:19
[ci skip]
@lukeholder lukeholder mentioned this pull request Jan 28, 2025
9 tasks
@lukeholder lukeholder merged commit 3576492 into 5.3 Jan 29, 2025
10 checks passed
@lukeholder lukeholder deleted the feature/5.3-persist-make-primary branch January 29, 2025 06:49
@nfourtythree
Copy link
Contributor

Commerce 5.3 has now been released with this included.

Thanks!

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.

2 participants