I am currently contemplating how to filter/search WooCommerce stock reports by product. I was thinking of adding an input box, like so:
and use it to reduce the number of Products shown in the list below.
Ideally, I'd like to use Javascript in order to make the filtering user-friendly. Using the WooCommerce API to create a whole new report page seems like overkill for such a small matter. So I thought, if I just made WooCommerce output all products in its stock reports, I could grab them afterwards and filter them with JS. That is where I am stuck since WooCommerce creates the report pages inside the WC_Report_Stock class. To be exact, it's preparing the output in the prepare_items method and sets the number of pages displayed to 20:
public function prepare_items() {
$this->_column_headers = array( $this->get_columns(), array(), $this->get_sortable_columns() );
$current_page = absint( $this->get_pagenum() );
$per_page = apply_filters( 'woocommerce_admin_stock_report_products_per_page', 20 );
$this->get_items( $current_page, $per_page );
/**
* Pagination.
*/
$this->set_pagination_args( array(
'total_items' => $this->max_items,
'per_page' => $per_page,
'total_pages' => ceil( $this->max_items / $per_page ),
) );
}
Since I don't want to change the Plugin Code, I am unsure of how to proceed and would hope for someone to point me in the right direction.