This is happening for line items coming from Commerce Discount which are being saved by other calls, but then subsequently overridden by an order object stored in $form_state['order'] in commerce_customer_profile_copy_validate. This function seems to have an old cached version. We think we fixed it by reloading the order at the beginning on the call. Patch to come.

Comments

christoph’s picture

Patch for issue above.

jsacksick’s picture

Status: Active » Needs work

You shouldn't rely on the order number to load the order, it contains the order id by default, but if you have a module that sets it to a different value, this won't work.

rszrama’s picture

Tagging for http://contribkanban.com/#/board/commerce/7.x-1.x.

This is related to other issues dealing with stale objects in form states I believe.

torgospizza’s picture

joelpittet’s picture

Status: Needs work » Closed (duplicate)

I'm quite sure this is a duplicate of the ones @torgosPizza mentioned in #4

+++ b/modules/customer/commerce_customer.module
@@ -1350,6 +1350,9 @@ function commerce_customer_profile_set_properties($profile, $name, $value) {
+  $form_state['order'] = commerce_order_load($form_state['order']->order_number);

This is wrong as it expects order_id not order_number
$order = commerce_order_load($form_state['order']->order_id);