How can I make the Woocommerce Products Widget display Products of a specific Category only? Current options are on-sale, featured, and all.
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
This can be done with a custom function hooked in
woocommerce_products_widget_query_args
filter hook. You will have to set inside it, in the array, your product category (or your product categories if more than one).Here is the code:
Code goes in function.php file of your active child theme (or theme) or also in any plugin file.
Tested in WooCommerce 3+ and works