Support » Plugin: OnSale Page for WooCommerce » Add category filtering feature

  • Hello,
    I modified the plugin in order to accept category filtering and replaced an array_merge with a simple cast as array in function

    public function mod_woocommerce_product_query($q, $WC_Query){
    		global $wp_query;
    		if($wp_query->is_sale_page) {
    			$product_ids_on_sale = apply_filters( 'wc_onsale_page_product_ids_on_sale', wc_get_product_ids_on_sale() );
    			$meta_query = WC()->query->get_meta_query();
    			$q->set( 'post__in', (array) $product_ids_on_sale );
    			if (isset($_GET['product-category']))
    				$q->set( 'product_cat', $_GET['product-category'] );

    This could be a good addition if someone wants to filter out certain categories dynamically which are on sale.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Add category filtering feature’ is closed to new replies.