Product Category Dropdowns 1.0.0
This plugin displays a drop-down select with root product categories.
After selecting the root category it displays another drop-down with sub categories and so on.
When the last sub category is selected it will redirect to the category page.
It is possible to select just one or two selects and click the search button.
It displays only the categories that have products.
Index:
Installation
1) Wordpress admin panel -> Plugins -> Add New
Click the "Upload Plugin" button (screenshot)
Select the product-category-dropdowns.zip file and click the "Install Now" button (screenshot)
Also you can install it manually.
Unzip the product-category-dropdowns.zip archive and upload 7 new files into "wp-content/plugins" directory of WordPress:
wp-content/plugins/product-category-dropdowns/Block/Selector.php
wp-content/plugins/product-category-dropdowns/product-category-dropdowns.php
wp-content/plugins/product-category-dropdowns/readme.txt
wp-content/plugins/product-category-dropdowns/view/frontend/templates/selector.php
wp-content/plugins/product-category-dropdowns/view/frontend/web/main.css
wp-content/plugins/product-category-dropdowns/view/frontend/web/main.js
wp-content/plugins/product-category-dropdowns/Widget/Selector.php
2) Activate Product Category Dropdowns plugin in:
Wordpress admin panel -> Plugins
(screenshot)
Back to the index
An example of how to use it
1) Create a new product category in: Wordpress admin panel -> Products -> Categories (screenshot)
2) Assign your product to the category. (screenshot)
3) Add the "Category Dropdowns" widget with mouse to the sidebar in: Wordpress admin panel -> Appearance -> Widgets . (screenshot)
4) Check the result on the front-end. The Category Dropdowns widget should be displayed on front-end in the sidebar. (screenshot)
Your new category should be available for selection in the drop-down select.
It should display only the categories that have products.
If the selected category has sub categories then it should display another select with the sub categories.
Back to the index
Display it with a shortcode
You can insert the categories box into page content with this shortcode:
[product_category_selector]
Also you can insert it in a PHP template file as:
<?php echo do_shortcode('[product_category_selector]'); ?>
Back to the index
Troubleshooting
- If it does not display all categories
Check if the categories have products.
- If this plugin does not work
Try to disable other plugins.
Try to use the default WooCommerce theme "Storefront".
Check if the browser error console has any error messages.
Check if the page HTML source has any error messages.
Try to enable WordPress debug logging by setting:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
in the wp-config.php file.
and then check if the log file:
wp-content/debug.log
contains any errors.
Back to the index