Home Forums WoodMart support forum Out of stock products to the end and labels

Out of stock products to the end and labels

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #371749

    elotrotomas
    Participant

    Hi, I tried this snippet that it doesn’t work:

    add_filter('posts_clauses', 'sin_stock_al_final_woocommerce');
    function sin_stock_al_final_woocommerce($posts_clauses) {
        global $wpdb;
        // Solo cambiar la consulta en los bucles de WooCommerce
        if (is_woocommerce() && (is_shop() || is_product_category() || is_product_tag() || is_product_taxonomy())) {
            $posts_clauses['join'] .= " INNER JOIN $wpdb->postmeta istockstatus ON ($wpdb->posts.ID = istockstatus.post_id) ";
            $posts_clauses['orderby'] = " istockstatus.meta_value ASC, " . $posts_clauses['orderby'];
            $posts_clauses['where'] = " AND istockstatus.meta_key = '_stock_status' AND istockstatus.meta_value <> '' " . $posts_clauses['where'];
        }
        return $posts_clauses;
    }

    Please if you can help me.

    #371839

    Hello,

    Could you provide more details about your purpose? What do you want to change?

    Best Regards

    #372044

    elotrotomas
    Participant

    Hi Elise, I want that all of out of stocks products be at the end of the catalog, the problem is that I applied a snippet that should work (I used it in another websites), but it didn’t work. As you can see in the image.

    Thanks!

    Attachments:
    You must be logged in to view attached files.
    #372122

    Hello,

    The product grid is the Woocommerce functionality and our theme does not have the option to change that.

    Our support does not cover testing and fixing third parties customization.

    If you have any questions please feel free to contact us.

    Best Regards

Viewing 4 posts - 1 through 4 (of 4 total)