WordPress.org

Support

Support » Plugins and Hacks » WooCommerce » Change Woocommerce Sort By Text

Change Woocommerce Sort By Text

Viewing 6 replies - 1 through 6 (of 6 total)
  • Yes,

    Use FileZilla or another FTP to access your root directory, and navigate to:

    wp-content/plugins/woocommerce/templates/loop/orderby.php

    Once you find “orderby.php” click the file to highlight it, then right click and choose “View/Edit”

    You will see the values you are looking to change within the file – e.g. “Newness.” Change those to whatever you want.

    Simply close the file to save your changes. Refresh your page to see them. Cheers.
    _______

    Does anyone reading this know how to change the characteristics of the “Sort By” button itself – e.g. make it smaller, change the colors, etc? I’m looking for the file to be able to do this

    Thanks for your help, but that’s the problem. I can’t find that piece of code at all. There is no orderby.php in the Loops folder, there is a sorting.php but it doesn’t have the ‘Newness’ I’m looking for. I tried looking all over the Woocommerce folder. Any help with where I can find it?

    Hmm, my update to WooCommerce 2.0 came with the orderby.php file (which included the “Sort by newness” option).

    I’m looking at the older “sorting.php” file and see that the code for changing the sort by title text is there (e.g. “default sorting,” etc.).

    Do you have more than one WooCommerce shop set up under your current host? Could you be in the wrong woocommerce/templates/loop/ folder? Sorry I can’t be of more help.

    This worked for me. I wonder if you are trying to find “orderby” within the admin editor panel of WordPress (meaning online) versus going to your hosting provider and navigating to the FTP section and editing the PHP file that way. For me, I am hosted with Godaddy so I go to Godaddy.com and log in and then navigate to my account area and then click hosting->click launch for the particular hosted account I want->click Files & FTP at the top left->file manager->and then navigate to the file that was listed in the above response.

    Hello,

    If you do not wish to use the template, then another way to change the text would be to add this:

    add_filter( 'gettext', 'theme_sort_change', 20, 3 );
    function theme_sort_change( $translated_text, $text, $domain ) {
    
        if ( is_woocommerce() ) {
    
            switch ( $translated_text ) {
    
                case 'Sort by newness' :
    
                    $translated_text = __( 'Sort by Newest', 'theme_text_domain' );
                    break;
            }
    
        }
    
        return $translated_text;
    }

    Check http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext for more details. I have used this method to avoid having to update templates if and when WooCommerce does any major update.

    This is absolutely the best way to do this. Do not modify system files because those files may be modified when future versions of plugins are updated.

    I just used this on a client site and it works perfectly.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Change Woocommerce Sort By Text’ is closed to new replies.
Skip to toolbar