Adding an Account ID to Shipping Object on Cart is Not Prefilling the Shipping #140
-
I'm not sure if something changed in the API, but I'm pretty sure that in the past when we added an account_address_id to the shipping object in a cart (PUT cart endpoint, {shipping: {account_address_id: ACOUNTADDRESSID}}, the cart then pre-filled the address from that address ID into the cart shipping object. This happened automatically immediately after the account_address_id was added to the cart shipping object. But we are running into situations now that this simply does not happen. The Cart has the correct Account_Address_Id on the shipping object, but the shipping address is simply not displayed on the cart, just the account_address_id. Is this the intended outcome now? In order to get the proper shipping address on the cart, we now have to actually PUT the entire address into the cart shipping object and sending in the account__address_id no longer has any effect? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
So as a follow up to the above, we located the precise bug. The issue is that if you add a shipping address to an Order in the admin dashboard, and that order is associated with a customer, there is no new address created for the customer or any new address at all. The dashboard simply pre-fills the shipping address fields without actually creating an address. This causes bugs per below. The solution would be to make sure that whenever an address is added to an order on the dashboard that is associated to the customer, that the address is added to the customer/addresses (actually save the address, and then associate it with a customer). So what's the bug (and this happens frequently, as a customer service agents needs to add/fix addresses to orders on the dashboard):
So in sum, manually adding a shipping address to an order via the dashboard, overrides any value that is from the account_address_id in the shipping object. This doesn't make sense, b/c the account_address_id should be what determines the shipping address for the order. I assume this is an issue b/c Swell runs on Mongo and there is no concept of a Foreign Key, so that the account_address_id isn't really meaningful. In which case, you need to add some precautionary code here so that the shipping address on the order, actually corresponds to the account_address_id, or else there are potentially many bugs that can occur. |
Beta Was this translation helpful? Give feedback.
-
Thanks. So I've tested this alot and here is what I found:
Our only workaround right now to the above is that we send in the entire shipping address to the cart on every update, as just sending in the account_address_id is simply unreliable. Many times, the address simply does not get updated when you send in new account_address_id. |
Beta Was this translation helpful? Give feedback.
-
@osseonews for shipping prefilling to work, you will need to add
|
Beta Was this translation helpful? Give feedback.
Thanks for the details. This appears to be a bug, but we'll investigate to be sure. The intended behavior is basically what you described.
A few specific things are supposed to happen:
If you update a record and set or change
account_address_id
, it will load address details into the shipping object, but if you also specify new shipping details in the same request, it will update the newly specified account address record as wellIf you update a record with an existing
account_address_id
, it will update the existing account address record with new detailsIf you set shipping details on a cart/order where no
account_address_id
exists, it will create a new account address record with t…