wc_get_default_product_rows_per_page()WC 3.3.0

Get the default rows setting - this is how many product rows will be shown in loops.

Хуков нет.

Возвращает

int.

Использование

wc_get_default_product_rows_per_page();

Список изменений

С версии 3.3.0 Введена.

Код wc_get_default_product_rows_per_page() WC 8.7.0

function wc_get_default_product_rows_per_page() {
	$rows         = absint( get_option( 'woocommerce_catalog_rows', 4 ) );
	$product_grid = wc_get_theme_support( 'product_grid' );
	$min_rows     = isset( $product_grid['min_rows'] ) ? absint( $product_grid['min_rows'] ) : 0;
	$max_rows     = isset( $product_grid['max_rows'] ) ? absint( $product_grid['max_rows'] ) : 0;

	if ( $min_rows && $rows < $min_rows ) {
		$rows = $min_rows;
		update_option( 'woocommerce_catalog_rows', $rows );
	} elseif ( $max_rows && $rows > $max_rows ) {
		$rows = $max_rows;
		update_option( 'woocommerce_catalog_rows', $rows );
	}

	return $rows;
}