0

Using magento 2.2, admin page. I need to hide button 'Send Mail' and 'Hold' in order page of status 'Pending'.

enter image description here

1 Answer 1

1

You need to override 1 file to achieve this.

Override /vendor/magento/module-sales/Block/Adminhtml/Order/View.php. Find and comment/remove below code:

if ($this->_isAllowedAction('Magento_Sales::emails') && !$order->isCanceled()) {
    $message = __('Are you sure you want to send an order email to customer?');
    $this->addButton(
        'send_notification',
        [
            'label' => __('Send Email'),
            'class' => 'send-email',
            'onclick' => "confirmSetLocation('{$message}', '{$this->getEmailUrl()}')"
        ]
    );
}

and

if ($this->_isAllowedAction('Magento_Sales::hold') && $order->canHold()) {
    $this->addButton(
        'order_hold',
        [
            'label' => __('Hold'),
            'class' => __('hold'),
            'id' => 'order-view-hold-button',
            'data_attribute' => [
                'url' => $this->getHoldUrl()
            ]
        ]
    );
}

That's done.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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