• Resolved msdesignfoto

    (@msdesignfoto)


    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 to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Steve

    (@skyvergesteve)

    Hey @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

    (@msdesignfoto)

    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

    And here is a random default category by name:
    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

    (@skyvergesteve)

    Hey @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.