WC_Admin_List_Table_Products::render_products_stock_status_filter()
Render the stock status filter for the list table.
Method of the class: WC_Admin_List_Table_Products{}
No Hooks.
Return
null
. Nothing (null).
Usage
$WC_Admin_List_Table_Products = new WC_Admin_List_Table_Products(); $WC_Admin_List_Table_Products->render_products_stock_status_filter();
Changelog
Since 3.5.0 | Introduced. |
WC_Admin_List_Table_Products::render_products_stock_status_filter() WC Admin List Table Products::render products stock status filter code WC 8.7.0
public function render_products_stock_status_filter() { $current_stock_status = isset( $_REQUEST['stock_status'] ) ? wc_clean( wp_unslash( $_REQUEST['stock_status'] ) ) : false; // WPCS: input var ok, sanitization ok. $stock_statuses = wc_get_product_stock_status_options(); $output = '<select name="stock_status"><option value="">' . esc_html__( 'Filter by stock status', 'woocommerce' ) . '</option>'; foreach ( $stock_statuses as $status => $label ) { $output .= '<option ' . selected( $status, $current_stock_status, false ) . ' value="' . esc_attr( $status ) . '">' . esc_html( $label ) . '</option>'; } $output .= '</select>'; echo $output; // WPCS: XSS ok. }