I would like to add a column in order grid in the admin customer edit page, the column should be an order link that open the order details page in new tab.enter image description here


I found a solution by creating a new module

in Vendor/Module/Block/Adminhtml/Grid/Column/Renderer/Link.php


namespace Vendor\Module\Block\Adminhtml\Grid\Column\Renderer;
use Magento\Framework\UrlInterface;

class Link extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer
 * @var Action\UrlBuilder
protected $actionUrlBuilder;

 * @param \Magento\Backend\Block\Context $context
 * @param Action\UrlBuilder $actionUrlBuilder
 * @param array $data
public function __construct(
    \Magento\Backend\Block\Context $context,
   UrlInterface  $actionUrlBuilder,
    array $data = []
) {
    $this->actionUrlBuilder = $actionUrlBuilder;
    parent::__construct($context, $data);

 * Render action
 * @param \Magento\Framework\DataObject $row
 * @return string
public function render(\Magento\Framework\DataObject $row)
    $getData = $row->getData();
    $href = $this->actionUrlBuilder->getUrl(
        'sales/order/view', ['order_id' => $getData['entity_id']]
    $orderID = $getData['increment_id'];
    return '<a href="' . $href . '" target="_blank">' . $orderID . '</a>';

In etc/module.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Vendor_Module" setup_version="0.0.1"> <sequence>
        <module name="Magento_Customer"/> </sequence>

Don't forget to replace Module and Vendor by your specific values and create a composer.json and registration.php files

| improve this answer | |

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.