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

Adding an extra 'orderby' from code

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.

I purchased the filter plugin through CodeCanyon and it's working well. I however want to add an extra 'orderby' to my WooCommerce product query, so that all out of stock products are shown last. The code underneath is working. The out of stock products are shown last, and the user can still filter.

function woocommerce_order_out_of_stock_products_last($args) {
    if(is_woocommerce() && !is_admin() && (is_shop() || is_product_category() || is_product_tag() || is_product_taxonomy())) {
        $args['orderby'] =" wc_product_meta_lookup.stock_status ASC," . $args['orderby'];
    }

    return $args;
}
add_filter( 'posts_clauses', 'woocommerce_order_out_of_stock_products_last', 999, 1 );

However, only the price filter is showing up when using this and all of the other filters are not showing up. It seems to interfere with the plugin's code.

How can I make sure the filters do show up when using this snippet?

Hello

We will do tests and will answer you soon