Discussing APIs and development related to customers, discounts, and order management.
Here's what I'm doing
When a bad address is passed to the draft order creating,
eg
"shippingAddress": {
"street": "Bad Address",
"unit": null,
"city": "Dunno City",
"state": "No State",
"country": "No Country",
"zip": null
}
the draft order saves this shipping order as is.
When the draft order is completed, the created order will change the "bad" country to the store's country.
"shippingAddress": {
"address1": "Bad Address",
"address2": null,
"city": "Dunno City",
"state": null,
"country": "<Store's country>"
}
Is there a way to detect this will happen before I mark the draft order as complete?
Right now, the only solution I can think of right now is to compare the created order's address with what I originally passed to the draft order. If they are not equal, then I cancel the order. However, I'd prefer the order is not created in the first place and I don't have to request `write_orders` scope from the merchant.
Oh, never mind. Just saw shippingAddress.coordinatesValidated.
Haha all that time thinking and writing before carefully looking at the docs🤦