Use the woocommerce_product_categories_widget_args
and woocommerce_get_availability
filters in a custom function to filter the product categories widget for out of stock products.
See what you can come up using these filters and post the code back here if you get stuck.
Here’s some code from my site which may help you get started.
add_filter( 'woocommerce_product_categories_widget_args', 'wpsites_exclude_product_cat_widget' );
function wpsites_exclude_product_cat_widget( $args ) {
$args['exclude'] = array('16','46');
return $args;
}
Here’s all the hooks for WooCommerce
Related Posts:
- How To Determine If A Filter Is Called In A Sidebar/Widget Context?
- WordPress: Apply filter/hook to a particular sidebar widgets?
- Need help using a filter on the default Categories widget
- Issue understanding and using WordPress filters and actions
- Passing a parameter to filter and action functions
- Get a list of all registered actions
- How can I edit post data before it is saved?
- Hide specific categories from category widget
- Extend WordPress 3.8 Site Activity Dashboard Widget to include more comments
- How to only hook on Single.php after content?
- How to influence the information displayed on widget inside wp-admin
- How to hook into unregistering a widget instance?
- Show Woocommerce minicart widget in checkout page sidebar? And, how to make this update secure by overriding widget?
- Add filter to blogroll widget
- Edit plugin without hooks in functions.php
- How to add a filter to all widget output
- Determining a Widget Instance and Sidebar Location?
- Shortcode from a widget is wrapped in unwanted element
- Filter Hook on plugin update
- Anyway to edit the titlebar of WordPress Widgets in the Admin area?
- Bookshelf plugin and/or widget [closed]
- Copy widget settings from one blog to another
- How to exclude certain widget from showing up on home/front page? [duplicate]
- How can I customize the wp_list_categories
- Unfiltered html in widget title not working
- Hide WordPress Plugin Deactivation Links
- Widget Area: Modify $param[‘xy’] from widget-$n
- Use external link in the add sub menu
- Pass A Value From Outside To A Plugin Variable
- Failed to invoke other hook from the init hook
- Does the ‘nav_menu_css_class’ filter accept 2 or 3 arguments?
- Custom widget using get_categories select menu dropdown
- do_action and hook methods
- How can I filter blog name?
- why does the add_action(‘the_content’) overwrite my page
- How to filter content post only on save
- Filter or action hook to insert content on admin pages before tag
- plugin_action_links_{$plugin_file} hook not in the main plugin file
- Woocommerce Shipping module available only for type of products [closed]
- Determine plugin name from within plugin_action_links filter
- merging an array to an existing array using add_filter
- WordPress tag cloud add more links
- Is it possible to enqueue a script from a widget method (of extended WP_Widget object)?
- Trying to wrap around first word of multiple word strings with a widget_title() filter, only works on two word strings and not more than two
- Replace category titles
- Reposition Woocommerce Message
- Disable widgets on specific posts
- Randomize attachment IDs
- Pass info from functions.php to plugin
- Excluding specific widgets from default sidebar class
- Change permalink structure hidden button edit
- Highlight “Show all” item in wp_list_categories
- How do action and filter hooks understand where to look for the core function that we hooked our function to them
- Inserting above the comment template
- Passing values from a widget to a function within a plugin
- Hooking in to replace the Sidebar/Widget areas
- Modifying the comments section through a plugin regardless of theme
- Get Time Taken By Each Action Hook in WordPress
- Filtering WooCommerce Orders by Category
- Replace a menu with widget or a custom template file programmatically
- Dynamically add content to an existing widget area
- Edit and make class-wc-widget-featured-products.php update-proof
- How to create a ‘single’ category widget for woocommerce plugin [closed]
- How to hide category name
- Grabbing how Many Posts by Month for a Dashboard Widget
- Redirect to another page using contact form 7? [closed]
- Template filter for custom taxonomy terms
- How to customize category_description()?
- Categories widget show empty?
- Add sub menu page in your plugin
- What exactly happens to function argument availability when using a filter?
- remove_action not removing add_action from constructor
- How to pass a special CSS class into widget li
- Show Woocommerce Product “attributes/extra information tab” in widget [closed]
- Filter WooCommerce Orders
- Filter Text from sidebar widget?
- How to use the pre_option filter before a plugin loads?
- How to use filter to disable adding a product to wishlist?
- WordPress: Add custom add_filter for custom functions
- Hook on widget context plugin to add custom context for widget
- Why can’t I shove an instance of a class into a variable from a do_action hook?
- Passing a parameter to filter and action functions
- trying to create simple plugin to filter categories from all authors
- wp_list_categories + widget
- Pass widget variable to external function
- Use of apply_filter in plugin/widget class
- change output location of plugin function using a custom hook
- How add short description Featured Products or Related Products
- How to use in_category?
- Conditionally enable autoplay when using oEmbed in a custom widget
- How do I stop out of stock items from appearing on my WooCommerce site when using the Layered Nav widget [closed]
- add query string to all pages after user logged in
- Widget does not work with WooCommerce enabled
- Order shipped by which driver[hook for woocoomerce order staus changed and popup in admin panel ] [closed]
- How to use apply_filters(‘get_calendar’) to change get_calendar() output?
- How to Add Extra Text In WordPress Title Before Post Publish
- Replace category titles inside RSS feed
- Change social icon in twenty twenty three theme
- Hide attributes based on previous selection
- Customize WP Filter Hook