Repository navigation
Supported way to update or remove a fulfillment's delivery address (for data-deletion requests) #17539
Antonio313
started this conversation in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
What we need
A supported way to update or remove a fulfillment's
delivery_address(thefulfillment_addressrow), so a store can erase a customer's personal details when the customer deletes their account.Why
Data protection laws (GDPR, and similar ones elsewhere) let customers ask for their personal data to be deleted. A store usually keeps past orders for tax and accounting, but removes who the customer was. In Medusa 2.x we can do that for orders:
updateOrdersandupdateOrderAddresseslet us clear the email, the customer link and the address down to region and country.Shipments are the gap.
createOrderFulfillmentWorkflowcopies the order's shipping address into the fulfillment'sdelivery_address(name, phone, street). After the order is anonymised, that copy still holds everything.What we found (Medusa 2.21.2, and 2.22.1 is the same)
UpdateFulfillmentDTOhas nodelivery_address, and the fulfillment module deliberately doesn't generate methods forFulfillmentorFulfillmentAddress("Not adding Fulfillment to not auto generate the methods under the hood"). The address service is internal to the module.updateFulfillment(id, { delivery_address: { id, first_name: null, ... } })is silently ignored.updateFulfillment(id, { delivery_address: { first_name: null, ... } })(noid) passes through to the ORM: it creates a new address row and repoints the fulfillment, but the old row stays infulfillment_address, untouched and not soft-deleted. So the personal data is hidden, not removed, and the old row is left orphaned. This looks unintended, and we're not relying on it.Possible shapes
Any of these would solve it:
delivery_addressinUpdateFulfillmentDTO, updating the existing row in place (by its id).updateFulfillmentAddresses(and ideallydeleteFulfillmentAddresses) method on the fulfillment module service, like the order module'supdateOrderAddresses.Happy to test a change against a real store if that helps.
All reactions