How to Add WooCommerce Filter by Stock Status?

Shoppers do not browse to find products they cannot buy. When out-of-stock items sit alongside available ones with no way to separate them, users waste clicks, lose patience, and leave. Stock status filtering removes that friction before it costs you a sale.

WooCommerce does not make this easy by default. Adding a proper stock status filter requires going beyond the basic settings. In this guide, you will learn how to add WooCommerce filter by stock status in details. Keep reading, learn other tips and guides about it.

When Stock Status Filters Are the Right Choice

Stock status filters make sense when product availability changes often and shoppers need a faster way to avoid items they cannot buy. They are especially useful on WooCommerce stores where out-of-stock, backorder, and in-stock products appear together across shop and category pages.

Stock status filtering works best when:

  • Product availability changes regularly across the catalog
  • Shoppers want to view only purchasable items
  • Store shows in-stock, out-of-stock, and backorder products together
  • Category pages contain too many unavailable items
  • Inventory updates need to be reflected in the filtering
  • Visitors are likely to leave after seeing sold-out products repeatedly

Quick Answer

Stock status filtering only works when WooCommerce knows your product availability. Before adding any filter method, stock management must be active and products must have proper stock values assigned.

  1. Enable stock management in WooCommerce
  2. Use a filter that supports stock status values
  3. Add the filter to shop or category layouts
  4. Test filtering for In Stock and Out of Stock products

How to Add WooCommerce Filter by Stock Status?

Every store handles inventory differently. Some need a simple hide setting, others need real-time product filters for WooCommerce that update availability instantly as stock changes. The four methods below cover the full range. Choose the one that fits where your store actually stands.

How to Add WooCommerce Filter by Stock Status

Method 1: WooCommerce Default Catalog Setting

The simplest way to handle stock visibility in WooCommerce is through the built-in catalog setting. This does not add a frontend filter shoppers can toggle — it silently hides out-of-stock products from the catalog globally.

Step 1: Open Inventory Settings

  • Go to WooCommerce → Settings → Products → Inventory
  • Confirm Manage Stock is enabled

Step 2: Hide Out-of-Stock Products

  • Check the Hide out of stock items from the catalog option
  • Save changes

Step 3: Verify on the Frontend

  • Visit the shop or category page
  • Confirm out-of-stock products no longer appear in the catalog

Limitations

  • Shoppers cannot choose which stock status to view
  • No visible filter or toggle on the frontend
  • Products are hidden globally — no dynamic control
  • Not suitable for stores where backorder or out-of-stock visibility matters

Method 2: URL-Based Stock Status Filters

URL-based stock filtering exposes availability as a query parameter in the page URL. Shoppers or linked campaigns can trigger filtered views directly, and results update based on the stock status value passed through the URL.

Step-by-Step Setup

Step 1: Enable Stock Status URL Parameters

  • Use a filter plugin or custom code that supports stock status URL parameters
  • Define the stock status parameter format — for example: ?stock_status=instock

Step 2: Map Stock Status Values

  • Confirm the following values are recognized by your filter setup:
    • instock
    • outofstock
    • onbackorder

Step 3: Update Product Queries

  • Ensure the URL parameter correctly updates the WooCommerce product query
  • Test that only products matching the stock status value appear in results

Step 4: Handle SEO Correctly

  • Add noindex rules for all stock-filtered URLs
  • Set canonical URLs pointing back to the main category or shop page
  • Confirm filtered URLs are excluded from your sitemap

Step 5: Test Filtering Behavior

  • Manually append stock status parameters to your shop URL
  • Verify correct products appear for each stock status value
  • Check that canonical and noindex rules are firing correctly

Method 3: AJAX Filter Plugin

Real-time stock status filtering requires Dynamic AJAX Product Filters for WooCommerce. This plugin handles this by updating availability results instantly as shoppers toggle stock status. We’ll use this plugin in this process.

Step 1: Install and Activate the Plugin

  • Go to WordPress Admin → Plugins → Add New
  • Search for Dynamic AJAX Product Filters for WooCommerce
  • Click Install Now then ActivateInstall and Activate the Plugin

For the pro version, purchase it from the official website, download the ZIP file, and install it via Plugins → Add New → Upload Plugin. The pro version unlocks advanced logic controls, additional filter styles, and deeper customization options.

Install and Activate the pro Plugin

Step 2: Enable Stock Status in Form Manage

  • Go to Product Filters → Form Manage in your WordPress dashboard
  • Locate the Show Stock Status option
  • Toggle it on to make the stock status filter visible in the widget

Enable Stock Status in Form Manage

Step 3: Style the Stock Status Widget

  • Go to Product Filters → Form Style
  • Select Stock Status from the Select Attribute dropdown
  • Choose a filter style then display style for the filter
  • Configuire optional and advanced settings

Style the Stock Status Widget

Step 4: Save and Display the Filter

  • Click Save to apply all settings
  • Go to the page where you want the filter to appear
  • Add the shortcode to your shop or category page [[plugincy_filters]]

Method 4: Custom Code Stock Status Filter

Developers who need complete inventory control without a plugin can implement stock status filtering directly through PHP. This method hooks into the WooCommerce product query and filters results based on the _stock_status meta value passed through a frontend control.

Step 1: Open Your Functions File

  • Open your theme’s functions.php file or create a dedicated custom plugin file
  • Avoid editing core WooCommerce files directly; changes will be lost on updates

Step 2: Hook Into the Product Query

  • Use the pre_get_posts hook to intercept the WooCommerce product query
  • Check that the query is the main query and running on a shop or category page before applying any logic

Step 3: Read the Stock Status Parameter

  • Retrieve the stock status value from the URL query string
  • Accepted values are:
    • instock
    • outofstock
    • onbackorder
  • Sanitize the value before passing it into the query

Step 4: Build the Meta Query

  • Add a meta_query targeting the _stock_status meta key
  • Pass the sanitized stock status value as the comparison value
  • Return the modified query back to WooCommerce

Step 5: Create a Frontend Control

  • Build a dropdown or checkbox input on the shop or category page
  • Ensure selections append the correct stock status parameter to the URL
  • Test that the parameter persists correctly across pagination

Step 6: Test Thoroughly

  • Manually append each stock status value to the shop URL and verify correct products appear
  • Test edge cases; no value selected, all values selected, switching between statuses
  • Confirm the query does not interfere with other active filters

Limitations

  • Requires PHP and WooCommerce query knowledge
  • No built-in AJAX unless manually implemented
  • Higher maintenance risk during WooCommerce updates

Quick Method Comparison

These methods cover stock status filtering in WooCommerce. Each suited to a different store size, technical level, and control requirement. The table below breaks down how they compare across the factors that matter most.

MethodReal FilterAJAX SupportUser ControlBeginner FriendlySEO ControlBest For
WooCommerce Hide SettingVery small stores
URL-Based Filter⚠️⚠️SEO-controlled stores
AJAX Filter PluginLarge catalogs, real-time filtering
Custom Code⚠️ Manual⚠️Developer-built stores

How to Combine Stock Filters With Other Filters?

Stock status filtering works harder when it runs alongside other filters. A single availability toggle narrows the catalog by one dimension, combining it with other filters gives shoppers a focused, purchase-ready result set without extra navigation.

  • Stock + Price Filter: Shoppers can filter by budget and availability at the same time, eliminating both out-of-range and out-of-stock products in one action
  • Stock + Category Filter: Combining stock status with a category filter in WooCommerce keeps results scoped to a specific product type while surfacing only available items, reducing visible clutter without losing relevance
  • Stock + Attribute Filter: Pairing stock status with size or color filters is especially useful for apparel and footwear stores where specific variations go out of stock frequently
  • Stock + Brand Filter: Brand-loyal shoppers can filter by their preferred brand and availability together, avoiding the frustration of finding their chosen brand is sold out
  • Stock + Rating Filter: Useful for stores where social proof drives decisions, shoppers can surface highly rated products that are also currently available
  • Always Use OR Logic for Stock Status: When combining stock status with other filters, OR logic ensures results remain broad enough to stay useful. AND logic can shrink the result set too aggressively and return zero products.

NO. 1 AJAX Product Filters for WooCommerce

What to Do If Your Stock Status Filter Doesn’t Work Properly?

Stock filters are super helpful when it comes to showing only available products. But like anything else in your store, they can sometimes act up. Maybe they stop working, show wrong results, or disappear completely. If that’s happening, here’s what you can try to get things running smoothly again.

  • Check Plugin Conflicts: Try disabling other plugins one by one to see if one of them is clashing with your stock filter setup.
  • Switch to Default Theme: Temporarily change your theme to the default one and see if the filter starts working without problems.
  • Clear Cache Files: Sometimes, outdated cache files stop changes from showing up, so clearing browser and site cache can solve the issue.
  • Review Filter Settings: Go back into your filter plugin’s settings and double-check if everything is turned on and set the right way.
  • Update Everything: Make sure your plugins, theme, and WooCommerce are all up to date with the latest versions available.
  • Check Product Stock Info: Filters won’t work if your products are missing stock status, so check if they’re marked in or out of stock.
  • Ask Plugin Support: If nothing else works, contact the filter plugin’s support team—they might know a fix for your exact setup.

Fixing filter problems doesn’t have to be hard if you follow each step patiently. A small issue could just need a simple update or a setting change. Don’t rush—test things one at a time. Keep your store smooth and easy for everyone to shop.

Tips to Improve Product’s Stock Status Filtering in WooCommerce

Stock status filters work best when they help shoppers make quick buying decisions without adding friction. Clear labels, useful combinations, and better visibility can make availability-based filtering far more practical on the shop page.

  • Keep Stock Labels Clear: Use simple terms like In Stock, Out of Stock, and On Backorder so shoppers understand product availability instantly.
  • Show In-Stock Products First: Prioritizing available items helps users reach purchasable products faster and improves the browsing flow.
  • Hide Out-of-Stock Options When Needed: For fast-moving stores, removing unavailable products from filter results can reduce frustration and keep the shop page cleaner.
  • Combine Stock With Related Filters: Stock status becomes more useful when paired with filters shoppers already use, such as price, size, or brand. Many stores that also add filter by color in WooCommerce get better results when stock and color work together naturally.
  • Use Counts Beside Stock Options: Showing how many products are available under each stock status helps users decide before clicking.
  • Test Stock Filtering on Variable Products: Make sure variation-based items display the correct stock condition, especially when some options are available and others are not.
  • Make Active Stock Filters Easy to Remove: Shoppers should be able to clear a stock filter quickly without resetting the full filter setup.
  • Check Mobile Usability: Stock filters should be easy to open, tap, and clear on smaller screens without taking over the whole browsing experience.

FAQs About WooCommerce Stock Status Filters

Stock status filtering raises a different set of questions than price, category, or attribute filters. Store owners usually want to know how it affects product visibility, variation handling, and the overall shopping flow. These FAQs cover practical concerns that often come up once the filter is added and tested on a live WooCommerce store.

Can Stock Status Filters Work on Both Shop and Category Pages?

Yes, they can be used on both. This helps shoppers narrow available products whether they start from the main shop page or land directly on a specific product category.

Do Stock Status Filters Update Automatically When Inventory Changes?

They usually do, as long as product stock data is being managed correctly in WooCommerce. When stock values change, the filter can reflect those updates in the product results.

Can I Use Stock Status Filters for Backorder Products Too?

Yes, if your setup supports that stock value. This is useful for stores that still want to show purchasable items even when they are not currently available for immediate shipping.

Will Stock Status Filtering Still Work With Variable Products?

Yes, but it depends on how variation stock is configured. Stores with size, color, or other variation-based products should test carefully to make sure the correct availability is shown.

Is Stock Status Filtering Useful for Small WooCommerce Stores?

It can be, especially when even a smaller catalog includes unavailable items that may frustrate shoppers. A stock filter becomes more useful when product availability changes often or customers need faster product discovery.

Conclusion

Learning how to add WooCommerce filter by stock status helps make product discovery more practical for shoppers who only want to see what they can actually buy. Whether you use a built-in setting, URL logic, an AJAX filter plugin, or custom code, the right method depends on how much control your store needs. What matters most is keeping stock filtering clear, accurate, and easy to use across both desktop and mobile.

Leave a Comment

Your email address will not be published. Required fields are marked *

Shopping Cart
Scroll to Top