WC_Admin_List_Table_Coupons::render_filters()protectedWC 1.0

Render any custom filters and search inputs for the list table.

Method of the class: WC_Admin_List_Table_Coupons{}

No Hooks.

Return

null. Nothing (null).

Usage

// protected - for code of main (parent) or child class
$result = $this->render_filters();

WC_Admin_List_Table_Coupons::render_filters() code WC 9.3.3

<?php
protected function render_filters() {
	?>
	<select name="coupon_type" id="dropdown_shop_coupon_type">
		<option value=""><?php esc_html_e( 'Show all types', 'woocommerce' ); ?></option>
		<?php
		$types = wc_get_coupon_types();

		foreach ( $types as $name => $type ) {
			echo '<option value="' . esc_attr( $name ) . '"';

			if ( isset( $_GET['coupon_type'] ) ) { // WPCS: input var ok.
				selected( $name, wc_clean( wp_unslash( $_GET['coupon_type'] ) ) ); // WPCS: input var ok, sanitization ok.
			}

			echo '>' . esc_html( $type ) . '</option>';
		}
		?>
	</select>
	<?php
}