You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Making a post to commerce/cart/update-cart and posting a new shippingAddress address and billingAddress. The cart response is shown in the screenshot, but there seems to be some oddity between cart.shippingAddress and cart.shippingAddressId:
cart.shippingAddress has various fields, firstName etc, and cart.shippingAddress.id has a value. But cart.shippingAddressId is null.
This is a bit frustrating as we're using the shippingAddressId to check that there is a shipping address added, and that the user can continue on with checkout. Except with a null value, it's saying that the address isn't complete. So I can obviously check the shippingAddress object, but this seems inconsistent and confusing, is it a bug?
Steps to reproduce
Post a shipping Address and Billing Address to the cart controller via AJAX. They're posted without shippingAddressSameAsBilling or vice versa, as in shippingAddress[firstName] is posted, so too is billingAddress[firstName] is posted. Due to the way my Vue is set up, it's often the same values for each.
This seems the same for guest checkout, or for logged in user
Additional info
Craft version: 3.1.31
PHP version: 7.1.29
Database driver & version:
Plugins & versions:
Commerce Version: 2.1.7
The text was updated successfully, but these errors were encountered:
I've dug into this and I think the problem lies in craft\commerce\elements\Order::afterSave(). Essentially, once a new address is saved, the order's record is updated, but the element model isn't updated with the new ID.
Description
Making a post to
commerce/cart/update-cart
and posting a new shippingAddress address and billingAddress. The cart response is shown in the screenshot, but there seems to be some oddity betweencart.shippingAddress
andcart.shippingAddressId
:cart.shippingAddress
has various fields, firstName etc, andcart.shippingAddress.id
has a value. Butcart.shippingAddressId
is null.This is a bit frustrating as we're using the
shippingAddressId
to check that there is a shipping address added, and that the user can continue on with checkout. Except with a null value, it's saying that the address isn't complete. So I can obviously check theshippingAddress
object, but this seems inconsistent and confusing, is it a bug?Steps to reproduce
shippingAddressSameAsBilling
or vice versa, as inshippingAddress[firstName]
is posted, so too isbillingAddress[firstName]
is posted. Due to the way my Vue is set up, it's often the same values for each.Additional info
The text was updated successfully, but these errors were encountered: