• Resolved njbebop

    (@njbebop)


    Hi Everyone,

    I’m currently running a WP 3.8.1 install with WP E-Commerce plugin. The powers that be want to be able to sort their products to move out of stock items to the back of the line.

    I have the filter in my functions.php, and it updates the existing query with whatever I put in.

    add_filter( ‘posts_orderby’, ‘products_orderby’ );

    function products_orderby( $orderby )
    {
    global $wpdb;
    $orderby = <ORDER BY _WPSC_STOCK META_VALUE HERE>;
    return $orderby;
    }

    I know this is incorrect, I need to know what I can put into the function to order this by the meta_value. I’ve been looking everywhere, seen every variation, and nothing seems to work.

    Thanks!

    https://www.ads-software.com/plugins/wp-e-commerce/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Order products by stock quantity’ is closed to new replies.