Feature requests

Show Out of stock products at the end

3y agoCompleted

Please enable the option to display Out of stock products at the end of the product archive.

and 25 others

7 comments

  1. Released in update 7.6

  2. Exciting news for us ❤️❤️💥💥💥

  3. Илья3y ago

    Hello!

    Code for function.php for this:

    function custom_product_query( $clauses, $query ) {

    global $wpdb;

    $clauses['join'] .= "

    LEFT JOIN {$wpdb->prefix}postmeta out_of_stock_meta

    ON ({$wpdb->prefix}posts.ID = out_of_stock_meta.post_id

    AND out_of_stock_meta.meta_key = '_stock_status'

    AND out_of_stock_meta.meta_value = 'outofstock')

    ";

    $clauses['orderby'] = "out_of_stock_meta.meta_value ASC, {$clauses['orderby']}";

    return $clauses;

    }

    add_filter( 'posts_clauses', 'custom_product_query', 10, 2 );

  4. Exactly I need this feature. I think that a lot of Woodmart users need this feature, but they don't know it! If they knew the effect of this on the sale of their site, it would not be possible for this post to have so many votes!

  5. I've got a code from the Support team, to do that. Is manual, but it works. CHeck the forum

  6. DEfinetly something usefull for me as well

  7. Another amazing tool. Today we need to use plugins or snippets to do that and is not perfect.