0

I've searched everywhere on the internet and tried to code it myself I want to change the default "Select A Category" placeholder text to "Select A Sub Category" so far I have tried this but it's not working:

function _category_dropdown_filter( $list_args ) { $list_args['show_option_none'] = __('Select A Sub Category'); return $list_args; } add_filter( 'woocommerce_product_categories_widget_arg' , '_category_dropdown_filter' );

Also, I have even tried to edit this file here but I see no "Select A Category" woocommerce/includes/widgets/class-wc-widget-product-categories.php

2

This worked for me:

add_filter( 'wp_dropdown_cats', function( $html, $args ) {
    if ( $args['taxonomy'] === 'product_cat' ) {
        $html = str_replace( '<select', '<select data-placeholder="New Placeholder"', $html );
    }
    return $html;
}, 10, 2);
0

Try to using apply_filters in your functions.php

apply_filters( 'woocommerce_product_categories_widget_args','art_architecture_textbooks' );
function art_architecture_textbooks( $cat_args ) {
        $cat_args['show_option_none'] = __('Art & Architecture');
        return $cat_args;
}

Learn more https://siteorigin.com/thread/change-category-widget-default-text-select-a-category/

  • Unfortunately it doesn't work I tried that code from siteorigin already and even tried to play around with it and still no luck... :( – Nexus Tees Sep 24 '18 at 14:15
  • Please also refer stackoverflow.com/questions/14079259/… – Pratik Patel Sep 24 '18 at 14:17
  • I have done that as well it only changes the Wordpress dropdown categories widget placeholder not the Woocommerce dropdown product categories widget placeholder – Nexus Tees Sep 24 '18 at 14:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.