How to create a ‘single’ category widget for woocommerce plugin [closed]

A bit late but perhaps this might still help someone…

If you don’t mind hardcoding the parent category name, slug and ID (e.g. “All”, “designer”,”38″) this works for creating a dropdown to jump to child categories of the specified ID:

<?php   
$terms = get_terms( 'product_cat', 'child_of=38' );
if ( $terms ) {
    print( '<select name="product_cat" id="dropdown_product_cat">' );
    print( '<option value="designer" selected="selected">All</option>' );
    foreach ( $terms as $term ) {
        printf( '<option value="%s">%s</option>', esc_attr( $term->slug ), esc_html( $term->name ) );
    }
    print( '</select>' );
} ?>
<script type="text/javascript">
/* <![CDATA[ */
        var product_cat_dropdown = document.getElementById("dropdown_product_cat");
        function onProductCatChange() {
                if ( product_cat_dropdown.options[product_cat_dropdown.selectedIndex].value !=='' ) {
                        location.href = "https://wordpress.stackexchange.com/questions/82981/<?php echo home_url(); ?>/?product_cat="+product_cat_dropdown.options[product_cat_dropdown.selectedIndex].value;
                }
        }
        product_cat_dropdown.onchange = onProductCatChange;
/* ]]> */
</script>