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 influence the information displayed on widget inside wp-admin
- 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?
- Filter Hook on plugin update
- Anyway to edit the titlebar of WordPress Widgets in the Admin area?
- Bookshelf plugin and/or widget [closed]
- 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
- Widget Area: Modify $param[‘xy’] from widget-$n
- Use external link in the add sub menu
- 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
- 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
- Inserting above the comment template
- Passing values from a widget to a function within a plugin
- 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 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?
- 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
- How to register a widget when saving a post?
- How to append custom text to the output of ‘categories widget’?
- Hook for altering the content of all wp mails
- Why would apply_filters return a non-empty string, when the value returned is empty?
- Preset Widgets ONLY after site is initially created
- recent comments filter by author, page, category
- Use a hook or filter, or overwrite this Gamipress function?
- Add filter for specific category only
- Adding custom post category to categories widget
- Unpublished Pages Failing To Appear On Custom Path
- Randomize post (and page) IDs on generation
- how can I edit the HTML of yith ajax product filter
- Plugin function in child theme
- Use action, filter, or hook to append HTML to WordPress plugin function
- Correct Hook/Filter to amend category choices on post edit page
- Customize plugin templates
- 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]
- Widget does not work with WooCommerce enabled
- 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