Automattic\WooCommerce\Internal\Admin\Orders

ListTable::get_max_num_pagesprivateWC 1.0

Get the max number of pages from orders or from cache.

Method of the class: ListTable{}

No Hooks.

Returns

Int.

Usage

// private - for code of main (parent) class only
$result = $this->get_max_num_pages( $orders );
$orders(required) (passed by reference — &)
.

ListTable::get_max_num_pages() code WC 10.3.3

private function get_max_num_pages( &$orders ) {
	if ( ! isset( $this->order_query_args['no_found_rows'] ) || ! $this->order_query_args['no_found_rows'] ) {
		return $orders->max_num_pages;
	}

	$count         = $this->count_orders_by_status( $this->order_query_args['status'] );
	$limit         = $this->get_items_per_page( 'edit_' . $this->order_type . '_per_page' );
	$orders->total = $count;

	return ceil( $count / $limit );
}