PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]

Support Forum

You need to log-in to create request (topic) to the support

How to add_filter() only when Product Filter values have been selected

The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page please
If you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.

Hello!

I am using the below filter to ensure that only variations that are in stock are displayed.

add_filter('woof_get_request_data', 'g_woof_get_request_data');

function g_woof_get_request_data($data){
$data['stock']='instock';
return $data;
}

How could I make this apply only while Product Filter is set? If user does not select filter, then I would also return out-of-stock items.

Look forward to your thoughts. Thank you

Hello

you can  use  something like:

function g_woof_get_request_data($data){

if(isset($_GET[swoof])){
$data['stock']='instock';

}
return $data;
}

That works perfectly! Thank you!!

Hello

Welcome;)