Select Value Not Submitting | WordPress.org

[ad_1]

Actually I’m converting default woocommerce sorting select to M3 Web Select. Here is code,

https://material-web.dev/components/select/

<form class="woocommerce-ordering" method="get">
	<md-outlined-select form name="orderby" class="orderby" aria-label="<?php esc_attr_e( 'Shop order', 'woocommerce' ); ?>">
		<?php foreach ( $catalog_orderby_options as $id => $name ) : ?>
			<md-select-option value="<?php echo esc_attr( $id ); ?>" <?php selected( $orderby, $id ); ?>>
				<div slot="headline"><?php echo esc_html( $name ); ?></div>
			</md-select-option>
		<?php endforeach; ?>
	</md-outlined-select>
	<input type="hidden" name="paged" value="1" />
	<?php wc_query_string_form_fields( null, array( 'orderby', 'submit', 'paged', 'product-page' ) ); ?>
</form>

this code render select perfectly but after selecting it’s not submiting it’s value.

Here is woocommerce default sorting select which is working fine

<form class="woocommerce-ordering" method="get">
	<select name="orderby" class="orderby" aria-label="<?php esc_attr_e( 'Shop order', 'woocommerce' ); ?>">
		<?php foreach ( $catalog_orderby_options as $id => $name ) : ?>
			<option value="<?php echo esc_attr( $id ); ?>" <?php selected( $orderby, $id ); ?>><?php echo esc_html( $name ); ?></option>
		<?php endforeach; ?>
	</select>
	<input type="hidden" name="paged" value="1" />
	<?php wc_query_string_form_fields( null, array( 'orderby', 'submit', 'paged', 'product-page' ) ); ?>
</form>


 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer