How to set primary billing & shipping address? #3304
-
I haven't found any documentation on the Commerce docs regarding how to set a customer's primary billing & shipping addresses. I can see from the example templates that there is an ability during checkout to add an address and flag it to be one/both of these primary addresses, but in terms of editing this preference later, I can't see any evidence as to how to accomplish this. What I have managed to do is, if I add a custom field to the User's profile, with a handle of If I submit a form to Same applies for Looking forward to any input! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
You would submit
It was never possible to update the primary address IDs preference on a customer save previously (only on address save or cart address save), but it looks like it should be possible to make it possible in Commerce 4. I will look into that now. We are working to improve the docs and will take the feedback on board. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Thanks @lukeholder , appreciate the steer on this one. I have been able to get this to work as you've outlined. FWIW, the |
Beta Was this translation helpful? Give feedback.
You would submit
isPrimaryBilling
orisPrimaryShipping
param to theusers/save-address
action when saving the current users address. This is mentioned in the https://craftcms.com/docs/commerce/4.x/upgrading.html#saving-an-addressand here https://craftcms.com/docs/commerce/4.x/addresses.html#primary-billing-shipping-addresses
It was never possible to update the primary address IDs preference on a customer save previously (only on address save or cart address save), but it looks like it should be possible to make it possible in Commerce 4. I will look into that now.