Automattic\WooCommerce\Internal\Admin\Orders

ListTable::created_via_filterpublicWC 1.0

Render the created_via filter dropdown.

Method of the class: ListTable{}

No Hooks.

Returns

null. Nothing (null).

Usage

$ListTable = new ListTable();
$ListTable->created_via_filter();

ListTable::created_via_filter() code WC 10.3.3

<?php
public function created_via_filter() {
	// phpcs:disable WordPress.Security.NonceVerification.Recommended
	$current_created_via = isset( $_GET['_created_via'] ) ? sanitize_text_field( wp_unslash( $_GET['_created_via'] ) ) : '';

	$created_via_options = array(
		''                   => __( 'All sales channels', 'woocommerce' ),
		'admin'              => __( 'Admin', 'woocommerce' ),
		'checkout,store-api' => __( 'Checkout', 'woocommerce' ),
		'pos-rest-api'       => __( 'Point of Sale', 'woocommerce' ),
	);
	?>

	<select name="_created_via" id="filter-by-created-via">
		<?php foreach ( $created_via_options as $value => $label ) : ?>
			<option value="<?php echo esc_attr( $value ); ?>" <?php selected( $value, $current_created_via ); ?>>
				<?php echo esc_html( $label ); ?>
			</option>
		<?php endforeach; ?>
	</select>
	<?php
}