I've followed this link to add custom button in Admin Sales Order View in Magento 2, and it works great. Now I want to replace this button with 3 dropdown options button. Something like changing store scope in Admin Panel. I want this 3 buttons to run same controller method with different parameters. How can i achieve this?
Thanks in advance.

1 Answer 1


This code works for me , try to look splitButton

class ViewPlugin

    public function beforeSetLayout(
        MagentoView $view,
        LayoutInterface $layout
    ) {
        $addButtonProps = [
            'id' => 'test',
            'label' => __('Test'),
            'class' => 'add',
            'button_class' => '',
            'class_name' => 'Magento\Backend\Block\Widget\Button\SplitButton',
            'options' => $this->getCustomActionListOptions(),

    protected function getCustomActionListOptions()
        /*list of button which you want to add*/
            'action_1'=>['label'=>__('Action 1'),'onclick'=>'setLocation("ACTION 1")'],
            'action_2'=>['label'=>__('Action 2'),'onclick'=>'setLocation("ACTION 2")'],
            'action_3'=>['label'=>__('Action 3'),'onclick'=>'setLocation("ACTION 3")']
        return $splitButtonOptions;

 <type name="Magento\Sales\Block\Adminhtml\Order\View">
    <plugin name="addMyButton" type="My\Module\Plugin\Block\Adminhtml\Order\View"/>
  • Thanks for your answer. Today or tomorrow i will try and let you know :)
    – SebastianT
    Jul 16, 2020 at 7:30
  • after i wrote above comment i realized that it uses the same plugin. So i tested and it works :D thanks, and also thanks for information that this is split button :D
    – SebastianT
    Jul 16, 2020 at 7:38

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.