Title: Sorting in different Categories
Last modified: January 22, 2021

---

# Sorting in different Categories

 *  Resolved [msdesignfoto](https://wordpress.org/support/users/msdesignfoto/)
 * (@msdesignfoto)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/sorting-in-different-categories/)
 * Hello
 * I installed your plugin and it works great actually. I was pondering manually
   reordering a lot of produts in several categories when I found it, so it saved
   me a lot of hand work.
 * However, I do have 2 very unique categories that need a manual sort. Each category
   only has 3 items and they need to be displayed from the cheapest to the more 
   expensive one.
 * Every other category will use from A to Z type of sorting. I have read that your
   plugin doesn’t support this, so I found a guide for setting up this exception.
   The issue is, I need to know the PHP variable needed to sort by name (from A 
   to Z). The variable for the price is already in the guide.
 *     ```
       //custom function to override default sort by category
       function custom_default_catalog_orderby() {
   
       //choose categories where default sorting will be changed
       if (is_product_category( array( 'category1', 'category2', 'category3' ))) {
           return 'date'; // sort by latest
   
       }else{
   
       return 'popularity'; // sort by popularity as the default
   
         } // end if statement
       } //end function
   
       add_filter( 'woocommerce_default_catalog_orderby', 'custom_default_catalog_orderby' ); //add the filter
       ```
   
 * I just need to know that variable name, change the parameters in this code and
   I’m all set.
 * Thank you!
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fsorting-in-different-categories%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Support [Steve](https://wordpress.org/support/users/skyvergesteve/)
 * (@skyvergesteve)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/sorting-in-different-categories/#post-13955238)
 * Hey [@msdesignfoto](https://wordpress.org/support/users/msdesignfoto/) ,
 * Thanks for contacting us about Extra Product Sorting Options! I’m happy to help
   out 🙂
 * Glad to hear the plugin is working out for you!
 * Just to clarify, are you looking for the variables used for sort by name? If 
   these are the variables you are in need of, they are:
 * alphabetical – Sort by name: A to Z
    reverse_alpha – Sort by name: Z to A
 * Can you please let me know if these variables help you to complete your customization?
 * Cheers,
    Steve SkyVerge
 *  Thread Starter [msdesignfoto](https://wordpress.org/support/users/msdesignfoto/)
 * (@msdesignfoto)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/sorting-in-different-categories/#post-13955304)
 * Hello Steve
 * I worked great. Thank you very much!
 * Here is one of the categories sorted by price:
    [https://copitrajecolombo.pt/categoria-produto/trajes-academicos/traje-nacional-feminino](https://copitrajecolombo.pt/categoria-produto/trajes-academicos/traje-nacional-feminino)
 * And here is a random default category by name:
    [https://copitrajecolombo.pt/categoria-produto/relogios_bonecos_alfineteiras](https://copitrajecolombo.pt/categoria-produto/relogios_bonecos_alfineteiras)
 * Now the sorting options are just perfect for the client.
 * I can’t thank you enough!
 * Cheers!
 *  Plugin Support [Steve](https://wordpress.org/support/users/skyvergesteve/)
 * (@skyvergesteve)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/sorting-in-different-categories/#post-13956029)
 * Hey [@msdesignfoto](https://wordpress.org/support/users/msdesignfoto/),
 * That is wonderful news! Glad to hear that you were able to get this in place.
   I took a look at the site and it seems to be working well 🙂
 * I’m going to mark this topic as resolved. If you run into anything else, please
   create a new thread — we’re happy to help!
 * Cheers!
 * Steve
    SkVerge

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Sorting in different Categories’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce-extra-product-sorting-options/assets/icon-256x256.
   png?rev=3303778)
 * [Extra Product Sorting Options for WooCommerce](https://wordpress.org/plugins/woocommerce-extra-product-sorting-options/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce-extra-product-sorting-options/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-extra-product-sorting-options/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-extra-product-sorting-options/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-extra-product-sorting-options/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-extra-product-sorting-options/reviews/)

## Tags

 * [category](https://wordpress.org/support/topic-tag/category/)
 * [different](https://wordpress.org/support/topic-tag/different/)
 * [sort](https://wordpress.org/support/topic-tag/sort/)

 * 3 replies
 * 2 participants
 * Last reply from: [Steve](https://wordpress.org/support/users/skyvergesteve/)
 * Last activity: [5 years, 3 months ago](https://wordpress.org/support/topic/sorting-in-different-categories/#post-13956029)
 * Status: resolved