• Resolved toodles53562

    (@toodles53562)


    Hello, How do I force my products to list alphabetically in woocommerce product catalog? I have indicated this in Appearace->product catalog->Product Sorting (custom + product name) but it is still not listing them alphabetically. How do I fix this? They are still all out of order

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Stef

    (@serafinnyc)

    You can write a hook for that and add it to your functions file inside your child’s theme. Do not add this to your parent theme. If you are not using a child theme you should. I see your using Flatsome, so see if they have a child theme available to you.

    add_action( 'woocommerce_product_query', 'custom_sort_products_alphabetically' );
    
    function custom_sort_products_alphabetically( $query ) {
        if ( ! is_admin() && is_product_category() && $query->is_main_query() ) {
            $query->set( 'orderby', 'title' );
            $query->set( 'order', 'ASC' );
        }
    }
    

    Then add this snippet below anything in the functions.php file of your child theme.

    Hi there, I trust the response above was helpful. We haven’t heard back from you in a while, so I’m going to mark this as resolved – we’ll be here if and/or when you are ready to continue.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to list products alphabetically in product category page’ is closed to new replies.