PHPackages                             mage2au/module-graphql-stock-filter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. mage2au/module-graphql-stock-filter

ActiveMagento2-module[API Development](/categories/api)

mage2au/module-graphql-stock-filter
===================================

Adds stock\_status filter support to Magento 2 GraphQL product queries for single-stock sites

1.0.0(8mo ago)052MITPHPPHP ^8.1

Since Sep 8Pushed 8mo agoCompare

[ Source](https://github.com/mage2-au/module-graphql-stock-filter)[ Packagist](https://packagist.org/packages/mage2au/module-graphql-stock-filter)[ RSS](/packages/mage2au-module-graphql-stock-filter/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (7)Versions (2)Used By (0)

Mage2AU GraphQL Stock Filter
============================

[](#mage2au-graphql-stock-filter)

A Magento 2 plugin that adds support for stock status filtering in GraphQL product queries, enabling efficient filtering of products by their inventory status.

Features
--------

[](#features)

- **GraphQL Stock Filtering**: Filter products by stock status in GraphQL queries
- **Multiple Value Formats**: Supports both string (`IN_STOCK`/`OUT_OF_STOCK`) and numeric (`1`/`0`) values
- **Universal Compatibility**: Works with both traditional single-stock and Multi-Source Inventory (MSI) setups
- **Performance Focused**: Efficient database joins to minimize query overhead
- **Error Handling**: Robust error handling with logging for debugging
- **Magento Standards**: Built following Magento 2 coding standards and best practices

Installation
------------

[](#installation)

### Via Composer (Recommended)

[](#via-composer-recommended)

```
composer require mage2au/module-graphql-stock-filter
php bin/magento module:enable Mage2AU_GraphQLStockFilter
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento cache:flush
```

### Manual Installation

[](#manual-installation)

1. Download or clone this repository
2. Copy files to `app/code/Mage2AU/GraphQLStockFilter/`
3. Enable the module:

```
php bin/magento module:enable Mage2AU_GraphQLStockFilter
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento cache:flush
```

Usage
-----

[](#usage)

### Basic GraphQL Query

[](#basic-graphql-query)

Filter products to show only in-stock items:

```
query {
  products(filter: { stock_status: { eq: "IN_STOCK" } }) {
    items {
      sku
      name
      stock_status
      price_range {
        minimum_price {
          regular_price {
            value
            currency
          }
        }
      }
    }
    total_count
  }
}
```

### Advanced Filtering

[](#advanced-filtering)

Combine stock status with other filters:

```
query {
  products(
    filter: {
      sku: { match: "24-MB" }
      stock_status: { eq: "IN_STOCK" }
      price: { from: "10", to: "100" }
    }
    pageSize: 20
    currentPage: 1
  ) {
    items {
      sku
      name
      stock_status
    }
    total_count
  }
}
```

### Supported Filter Values

[](#supported-filter-values)

ValueDescriptionExample`"IN_STOCK"`Products that are in stock`stock_status: { eq: "IN_STOCK" }``"OUT_OF_STOCK"`Products that are out of stock`stock_status: { eq: "OUT_OF_STOCK" }``"1"`Numeric: In stock`stock_status: { eq: "1" }``"0"`Numeric: Out of stock`stock_status: { eq: "0" }`### Example Response

[](#example-response)

```
{
  "data": {
    "products": {
      "items": [
        {
          "sku": "24-MB01",
          "name": "Joust Duffle Bag",
          "stock_status": "IN_STOCK"
        }
      ],
      "total_count": 1
    }
  }
}
```

### Manual Testing

[](#manual-testing)

You can test the module using any GraphQL client:

```
curl -X POST "https://your-magento-site.com/graphql" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "query { products(filter: { stock_status: { eq: \"IN_STOCK\" } }) { items { sku name stock_status } } }"
  }'
```

### Note

[](#note)

"Display Out of Stock Products" should be set to "Yes" for filtering to work. Go to Stores &gt; Configuration &gt; Catalog &gt; Inventory &gt; Display Out of Stock Products

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance61

Regular maintenance activity

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

244d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ae255eed43f6327ce2860fba901dcbf20186741875b42f98c9cb2734c4915bc6?d=identicon)[mage2-au](/maintainers/mage2-au)

---

Top Contributors

[![mage2-au](https://avatars.githubusercontent.com/u/75344636?v=4)](https://github.com/mage2-au "mage2-au (4 commits)")

---

Tags

graphqlfilterinventorymagento2stock

### Embed Badge

![Health badge](/badges/mage2au-module-graphql-stock-filter/health.svg)

```
[![Health](https://phpackages.com/badges/mage2au-module-graphql-stock-filter/health.svg)](https://phpackages.com/packages/mage2au-module-graphql-stock-filter)
```

###  Alternatives

[smile/elasticsuite

Magento 2 merchandising and search engine built on ElasticSearch

8044.5M33](/packages/smile-elasticsuite)[mollie/magento2

Mollie Payment Module for Magento 2

1121.6M10](/packages/mollie-magento2)[dotdigital/dotdigital-magento2-extension

Dotdigital for Magento 2

50374.2k18](/packages/dotdigital-dotdigital-magento2-extension)[swissup/module-search-mysql-legacy

Legacy mysql search for magento 2.4

10483.0k](/packages/swissup-module-search-mysql-legacy)[opengento/module-category-import-export

This module add the capability to import and export the categories from the back-office.

119.1k](/packages/opengento-module-category-import-export)[mage-os/module-inventory-reservations-grid

Add a grid with the list of inventory reservations.

126.8k](/packages/mage-os-module-inventory-reservations-grid)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
