Home Forums WoodMart support forum hide “sort by alphabetical” only in category page

hide “sort by alphabetical” only in category page

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #642308

    kidsdial4
    Participant

    in our category/catalog pages, we are seeing 2 sort options

    1)Default Sorting
    2)Sort by aphabetical

    We want to hide the “sort by alphabetical” only in category pages and rename the “Default sorting” to “sort by alphabetical”. please note this should affect only in catalog pages [ not in search results or any other pages ]

    i have added functions.php file code in private content

    #642508

    Hello,

    Now I have checked your categories pages and there is no “sort by alphabetical” drop-down situated: https://ibb.co/FLcKSxrT

    Regarding renaming “Default sorting” to “Sort by alphabetical” only on category pages, this functionality is not available in the theme by default. However, I found the following code from a search and tested it on our test site—it works as expected.

    You can add this code to your functions.php file:

    function custom_rename_default_sorting( $sort_options ) {
        if ( is_product_category() ) {
            if ( isset( $sort_options['menu_order'] ) ) {
                $sort_options['menu_order'] = __( 'Sort by alphabetical', 'woocommerce' );
            }
        }
        return $sort_options;
    }
    add_filter( 'woocommerce_catalog_orderby', 'custom_rename_default_sorting' );

    If this does not work on your site, additional customization may be required, as code customization is beyond the scope of our theme support.

    Best Regards,

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