I need to organize my products from the store so that out of stock items last. I found some tips here that have not worked for me because it is conflicting with the WOOF filter plugin.
I thought the solution would be to do a function that would put the out of stock items as menu item 1000, this way they would last forever.
I do not have much knowledge in PHP, so by researching a lot I’ve come up with something similar to what I need, but it’s still not working.
So I would need to make this function work for real.
Could someone help me, please?

Thank you

function out_stock_last () { 
    global $product;

    $woocommerce_menu_order = array();

    if ( !$product->is_in_stock() ) {
        $woocommerce_menu_order = 100;  

    // Return order
    return $woocommerce_menu_order;

Read more here: Woocommerce – Function to change the menu order


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: