woocommerce_pagination() │ WC 1.0

Output the pagination.

No Hooks.

Returns

void. Nothing (null).

Usage

woocommerce_pagination();

woocommerce_pagination() code WC 11.2.1

function woocommerce_pagination() {
	if ( ! wc_get_loop_prop( 'is_paginated' ) || ! woocommerce_products_will_display() ) {
		return;
	}

	$args = array(
		'total'   => wc_get_loop_prop( 'total_pages' ),
		'current' => wc_get_loop_prop( 'current_page' ),
		'base'    => esc_url_raw( add_query_arg( 'product-page', '%#%', false ) ),
		'format'  => '?product-page=%#%',
	);

	if ( ! wc_get_loop_prop( 'is_shortcode' ) ) {
		global $wp_rewrite;

		$args['base'] = esc_url_raw( str_replace( 999999999, '%#%', remove_query_arg( 'add-to-cart', get_pagenum_link( 999999999, false ) ) ) );

		if ( $wp_rewrite->using_permalinks() ) {
			$args['format'] = user_trailingslashit( $wp_rewrite->pagination_base . '/%#%', 'paged' );

			if ( ! $wp_rewrite->use_trailing_slashes ) {
				$args['format'] = '/' . ltrim( $args['format'], '/' );
			}
		} else {
			$args['format'] = false !== strpos( $args['base'], '?paged=%#%' ) ? '?paged=%#%' : '&paged=%#%';
		}

		$args['base'] = str_replace( $args['format'], '%_%', $args['base'] );
	}

	wc_get_template( 'loop/pagination.php', $args );
}