Jump to content

Edit History

Boris Le Meec

Boris Le Meec

Hi,

Since yesterday I try to programmatically change the delivery address of a cart, without any kind of even far success..

This is my code :

Context::getContext()->cart->updateAddressId(Context::getContext()->cart->id_address_delivery, $address->id);
Context::getContext()->cart->id_address_delivery = $address->id;
Context::getContext()->cart->id_address_invoice = $address->id;
Context::getContext()->cart->update();

I know for sure that the $cart from Context is the good one, I already add some products to it, and I also know for sure that $address is the good one.

The problem is that every time I try to set the address_delivery, when I try to get it after, it displays the address_id of the "default" customer address. (The first registered I think)

Do you have any idea of what am I doing wrong ?

Thanks a lot

Boris Le Meec

Boris Le Meec

Hi,

Since yesterday I try to programmatically change the delivery address of a cart, without any kind of even far success..

This is my code :

Context::getContext()->cart->updateAddressId(Context::getContext()->cart->id_address_delivery, $address->id);
Context::getContext()->cart->id_address_delivery = $address->id;
Context::getContext()->cart->id_address_invoice = $address->id;
Context::getContext()->cart->update();

I know for sure that the $cart from Context is the good one, I already add some products to it, and I also know for sure that $address is the good one.

The problem is that every time I try to set the address_delivery, when I try to get it after, it displays the address_id of the "default" customer address. (The first registered I think)

Do you have any idea of what am I doing wrong ?

Thanks a lot

×
×
  • Create New...