The following issues are found when updating an order item:

  • Quantity field not present.
  • Quantity turn to 0 when item is updated.
  • The price does not matched the price per quantity as configured in the price list.

Comments

kkumaren created an issue. See original summary.

kkumaren’s picture

StatusFileSize
new5.38 KB
kkumaren’s picture

Status: Active » Needs review
travis-bradbury’s picture

+  /**
+   * {@inheritdoc}
+   */
+  public function extractFormValues(FieldItemListInterface $items, array $form, FormStateInterface $form_state) {
[...]
+      $order_item->setQuantity($values['value']);
+      $unit_price = $this->chainPriceResolver->resolve($purchased_entity, $order_item->getQuantity(), $context);
+      $order_item->setUnitPrice($unit_price);
+    }
+  }
+

It doesn't feel right for the widget to do this. Shouldn't commerce handle this by refreshing the order?

What about adjustments and other things that come from order processors - do they run after these changes are made? I'm pretty sure they would need to.

joshmiller’s picture

StatusFileSize
new5.39 KB

Re-rolling.

joshmiller’s picture

Version: 8.x-1.0-rc2 » 8.x-1.x-dev
kkumaren’s picture

StatusFileSize
new5.66 KB

Check if product_variation is an instance of ProductVariation before getting the product object.

kkumaren’s picture

StatusFileSize
new5.72 KB

Forget to use the ProductVariation class