Step 1) Create di.xml
<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd"> <type name="MagentoCheckoutModelDefaultConfigProvider"> <plugin name="AddAttPlug" type="[vendor][module]ModelPluginDefaultConfigProvider" /> </type> </config>
Step 2) create plugin file DefaultConfigProvider.php
class DefaultConfigProvider
{
/**
*@var checkoutSession
*/
protected $checkoutSession;
/**
*Constructor
* @param CheckoutSession $checkoutSession
*/
public function __construct(CheckoutSession $checkoutSession)
{
$this->checkoutSession = $checkoutSession;
}
public function afterGetConfig(MagentoCheckoutModelDefaultConfigProvider $subject, $config)
{
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
foreach ($config['quoteItemData'] as &$item) {
$priceHelper = $objectManager->create('MagentoFrameworkPricingHelperData');
$quoteItem = $this->checkoutSession->getQuote()->getItemById($item['item_id']);
$price = $quoteItem->getProduct()->getPrice();
$formattedPrice = $priceHelper->currency($price, true, false);
$item['originalprice'] = $formattedPrice;
}
return $config;
}
}
Step 3) Override the /vendor/magento/module-checkout/view/frontend/web/js/view/summary/item/details.js to your module
**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'uiComponent',
'Magento_Checkout/js/model/quote'
], function (Component) {
'use strict';
return Component.extend({
defaults: {
template: 'Magento_Checkout/summary/item/details'
},
/**
* @param {Object} quoteItem
* @return {String}
*/
getValue: function (quoteItem) {
return quoteItem.name;
},
getItemBaseprice: function (quoteItem) {
return this.getPropertyDataFromItem(quoteItem, 'originalprice');
},
getPropertyDataFromItem: function (quoteItem, propertyName) {
var property,
itemDetails;
if (quoteItem.hasOwnProperty(propertyName)) {
property = quoteItem[propertyName];
}
var quoteItem = this.getItemFromQuote(quoteItem);
if (quoteItem.hasOwnProperty(propertyName)) {
property = quoteItem[propertyName];
}
if (property) {
this.storage().set('item_details' + quoteItem.item_id + propertyName, property);
return property;
}
itemDetails = this.storage().get('item_details' + quoteItem.item_id + propertyName);
return itemDetails ? itemDetails : false;
},
getItemFromQuote: function (item) {
var items = quote.getItems();
var quoteItems = items.filter(function (quoteItem) {
return quoteItem.item_id == item.item_id;
});
if (quoteItems.length == 0) {
return false;
}
return quoteItems[0];
}
});
});
Step 4) Override the vendor/magento/module-checkout/view/frontend/web/template/summary/item/details.html to your module add the below line.
<span class="originalprice" data-bind="text: getItemBaseprice($parent)"></span>

