• Resolved lonwi

    (@lonwi)


    Hello.

    I have noticed that there is small issue when the plugin is set to use ‘get’ method. It ignores selected filters. In order to sort this out I have made a small fix and added it to my theme functions. Maybe this will be helpful for someone. This is fast fix, possibly can be optimized.

    add_action('wppp_before_dropdown', 'woocommerce_products_per_page_dropdown_get_fix', 10);
    function woocommerce_products_per_page_dropdown_get_fix(){
    	$method = in_array( get_option( 'wppp_method', 'post' ), array( 'post', 'get' ) ) ? get_option( 'wppp_method', 'post' ) : 'post';
    
    	if($method === 'get'){
    		$filters = $_GET;
    		if(isset($filters) && !empty($filters)){
    			foreach($filters as $key => $value){
    				if(substr($key, 0, 6) === 'filter') {
    					echo '<input type="hidden" name="'.$key.'" value="'.$value.'">';
    				}
    			}
    		}
    	}
    
    }

    https://ww.wp.xz.cn/plugins/woocommerce-products-per-page/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Jeroen Sormani

    (@sormano)

    Hi,

    Thanks for the message & the created code.
    Can you tell me which filters you are using? Are these the default ones of WooCommerce?

    Its been a while since I tested with it with filters, but last thing I do remember is that it supposed to work so I’ll have a look at it soon to verify.

    Thanks!
    Jeroen

    Thread Starter lonwi

    (@lonwi)

    Just product attributes with layered navigation. I am currently developing this website so there is no real demo to show.

    Plugin Author Jeroen Sormani

    (@sormano)

    Thanks, I’m checked and verified the filters aren’t kept in the URL parameters.

    I’m logging an issue for that, in the next update it will work the same as the order-by drop down 🙂

    (don’t have a ETA on that update, but you’ve also solved it yourself so guess you’re already in the clear 😉

    Cheers,
    Jeroen

    Plugin Author Jeroen Sormani

    (@sormano)

    Hi,

    I’ve just pushed version 1.2.1 that fixes this issue 🙂

    Let me know if you still run into anything!

    Thanks,
    Jeroen

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Issue when GET method is set’ is closed to new replies.