I am creating a custom column in order grid and i am show the status YES/NO according to order status.

If product status complete then i will show YES in custom column otherwise processing, Canceled, hold, unhold and open then i am show NO.

enter image description here

Add additional column name is product status.

1 Answer 1


It is quite simple and the reason is that you don't need any new data to make the job. you may create a custom module in app/code/Vendor/OrderGrid .. (see screenshot of my module enter image description here

mine was Mbs/OrderGrid) In the file sales_order_grid.xml you can define your column

select select Required

the class Mbs\OrderGrid\Ui\Component\Listing\Column\OrderStatusRenderer is what you need to get right:

    class OrderStatusRenderer extends \Magento\Ui\Component\Listing\Columns\Column
         * Prepare Data Source
         * @param array $dataSource
         * @return array
        public function prepareDataSource(array $dataSource)
            if (isset($dataSource['data']['items'])) {
                foreach ($dataSource['data']['items'] as & $item) {
                    if ($this->getData('name') === 'status') {
                        if ($item[$this->getData('name')] == 'complete') {
  $result = 'Yes';
} else {
  $result = 'No';
                        $item[$this->getData('name')] = $result;
            return $dataSource;

hopefully, these infos answer your question

Your Answer

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

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