Wordpress plugins
WooCommerce Filter

WooCommerce Filter

Version : 1.0.1
Tested up to : 4.9.8
Number of download : 8
Author : PickPlugins
Average rating : 0 / 5 on 0 votes 0 votes, 0 avg.rating

Screenshots

WooCommerce Filter
WooCommerce Filter
WooCommerce Filter
WooCommerce Filter

Default WooCommerce shop page isn’t good enough for search and filter product as user needs, this plugin allows user to filter and search by their own needs and find the best product they are looking for. WooCommerce Shop Filter by http://pickplugins.com Live Demo Documentation Support Plugin Features Filter by keywords Filter by product categories Filter by product tags Filter by price range Filter by order & order by Filter onsale product Filter in-stock Filter by SKU How to use? Please go to “Widgets” page and see there is a widget “Woo Shop Filter”, you can use this on sidebars. There is no option currently, we will update soon. How to add custom search field and filter products? you can add custom search field by action hook and filter products as well, Step 1: Add search input field add_action('WooShopFilter_fields','WooShopFilter_field_my_custom_input', 30); function WooShopFilter_field_my_custom_input(){ $WooShopFilter = isset($_GET['WooShopFilter']) ? sanitize_text_field($_GET['WooShopFilter']) :""; // check this to ensure for is submitted from WooShopFilter. $_custom_input = isset($_GET['_custom_input']) ? sanitize_text_field($_GET['_custom_input']) :""; // Do not forget to sanitization if(!$WooShopFilter): $_custom_input = ''; endif; /* * * you can check conditional here. * * if(is_shop()): * execute code only shop page * endif; * * */ if(is_shop()): // this will only display under shop page and hide others page ?> <div class="field-wrapper"> <div class="label-wrapper"> <label class=""><?php echo __('Custom Input','wc-shop-filter'); ?></label> </div> <div class="input-wrapper"> <input type="search" placeholder="<?php echo __('Custom input','wc-shop-filter'); ?>" name="_custom_input" value="<?php echo $_custom_input; ?>"> </div> </div> <?php endif; } Step 2 verify input variable and put on product query arguments add_action( 'woocommerce_product_query', 'WooShopFilter_pre_get_posts_query_my_custom_input', 99 ); function WooShopFilter_pre_get_posts_query_my_custom_input( $query_args ){ $WooShopFilter = isset($_GET['WooShopFilter']) ? sanitize_text_field($_GET['WooShopFilter']) : ""; $_custom_input = isset($_GET['_custom_input']) ? sanitize_text_field($_GET['_custom_input']) :""; // Do not forget to sanitization if($WooShopFilter && $_custom_input){ // you can get ans set query arguments // try var_dump($query_args) to see available query arguments, like tax_query, meta_query, order, orderby $s = $query_args->get( 's' ); $query_args->set( 's', $_custom_input ); } } How to remove existing input fields? By action hook you can simply remove any input fields exist. remove_action('WooShopFilter_fields','WooShopFilter_field_keyword',30); remove_action('WooShopFilter_fields','WooShopFilter_field_categories',30); remove_action('WooShopFilter_fields','WooShopFilter_field_tags',30); remove_action('WooShopFilter_fields','WooShopFilter_field_price_range',30); remove_action('WooShopFilter_fields','WooShopFilter_field_order',30); remove_action('WooShopFilter_fields','WooShopFilter_field_orderby',30); remove_action('WooShopFilter_fields','WooShopFilter_field_onsale',30); remove_action('WooShopFilter_fields','WooShopFilter_field_in_stock',30); remove_action('WooShopFilter_fields','WooShopFilter_field_keyword',30); remove_action('WooShopFilter_fields','WooShopFilter_field_sku',30);

Download now