In quote_item table we don't have a column original_price. So when and how sales_order_item table get the original_price value.

Post order we are seeing original_price as 0 in admin sales order view page. Unable to locate where the original price is set as 0 in the sales_order_item table.

Anybody have idea about this?

  • Did you find answer for this? I have the same problem – Alex Dec 17 '19 at 10:47

In our case we were overwriting the originalprice in an observer, which did not come through to the order item.

Setting a breakpoint in \Magento\Sales\Model\Order\Item::setOriginalPrice you find that it is called on order by \Magento\Quote\Model\Quote\Item\ToOrderItem::convert

The original price is already in the $item passed to that function.

In my case the original_price is taken from the base_original_price, which is set to the catalog price.

This is happening in \Magento\Quote\Model\Quote\Address\Total\Subtotal::_initItem which calls

        $finalPrice = $product->getFinalPrice($quoteItem->getQty());

An option would be to overwrite the \Magento\Quote\Model\Quote\Item\AbstractItem::getBaseOriginalPrice

and overwrite the original price with the custom original price.


I recently ran into this problem with orders that were being imported programmatically and it was instructive to find out where that data is supposed to come from.

A quote item gets converted to an order item by \Magento\Quote\Model\Quote\Item\ToOrderItem::convert(). It does this by getting a list of attributes to copy from the fieldset and then calling their getters. Calling the getter \Magento\Quote\Model\Quote\Item\AbstractItem::getOriginalPrice() causes it to get calculated from base_original_price.

So the next question is where does \Magento\Quote\Model\Quote\Item\AbstractItem::getBaseOriginalPrice() come from? That attribute also gets copied from the quote item, but it is also not a value that is persisted in the database, so how does it get set on the quote item then? Turns out that during $quote->collectTotals(), it gets calculated and set on the quote item by \Magento\Quote\Model\Quote\Address\Total\Subtotal::_calculateRowTotal().

I hope that helps you identify where the breakdown is occurring, and be sure that \Magento\Quote\Model\Quote::collectTotals() is being called before the quote is converted to an order.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.