0

I want to add stock status dropdwon filter in product admin grid like this: enter image description here

I tried this: https://magecomp.com/blog/how-to-add-stock-status-column-in-admin-product-grid-magento-2/ but it didnt work.

2
  • What exactly didn't work? A bit more information would be helpful.
    – bdbdbd
    Apr 8, 2022 at 13:02
  • It is showing a few instock items as well when we search for out of stock items.
    – mechanic
    Apr 9, 2022 at 17:18

1 Answer 1

0

Hi @mechanic Try this one I hope it works-

<column name="stock_status">
        <argument name="data" xsi:type="array">
            <item name="options" xsi:type="object">Magento\CatalogInventory\Model\Stock\Status</item>
            <item name="config" xsi:type="array">
                <item name="filter" xsi:type="string">select</item>
                <item name="component" xsi:type="string">Magento_Ui/js/grid/columns/select</item>
                <item name="dataType" xsi:type="string">select</item>
                <item name="label" xsi:type="string" translate="true">Stock Status</item>
                <item name="sortOrder" xsi:type="number">10</item>
            </item>
        </argument>
    </column>

https://meetanshi.com/blog/add-stock-status-column-in-product-grid-in-magento-2/

3
  • I need to ass a "filter" not a column.
    – mechanic
    Apr 9, 2022 at 17:19
  • Hi @mechanic I have modified my answer. Apr 9, 2022 at 18:25
  • Thank you. I will try this.
    – mechanic
    Apr 10, 2022 at 9:41

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.