Magento – how to add product link on the checkout page order summary magento 2

checkout-pagemagento-2.1.8order-summary

I want to add link on the product which is showing in order summary on checkout page.

I have found HTML code in the file:

module-checkout\view\frontend\web\template\summary\item\details.html

Code:

<div class="product-item-name-block">
            <strong class="product-item-name" data-bind="text: $parent.name"></strong>
            <div class="details-qty">
                <span class="label"><!-- ko i18n: 'Qty' --><!-- /ko --></span>
                <span class="value" data-bind="text: $parent.qty"></span>
            </div>
        </div>

How to add href for the product name?

Best Answer

You need plugin for for class for class

Magento\Checkout\Block\Checkout\LayoutProcessor

On your plugin class ,you need pass product url as parameter of json object which is used at checkout summary

Please follow the folder and file from the blog http://www.blogtreat.com/magento-2-display-custom-product-attribute-checkout-summary/

Then you need to some changes at

$result['quoteItemData'][$index]['brand'] = $product->getResource()->getAttribute('brand')->getFrontend()->getValue($product);

to

$result['quoteItemData'][$index]['url'] = $product->getProductUrl().

Also on new summary.html you need to put url

<strong class="product-item-name" data-bind="text: $parent.name"></strong>
Related Topic