Automattic\WooCommerce\Internal\ProductAttributesLookup

DataRegenerator::get_last_existing_product_id()privateWC 1.0

Get the highest existing product id.

Метод класса: DataRegenerator{}

Хуков нет.

Возвращает

int|null. Highest existing product id, or null if no products exist at all.

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

// private - только в коде основоного (родительского) класса
$result = $this->get_last_existing_product_id(): ?int;

Код DataRegenerator::get_last_existing_product_id() WC 8.7.0

private function get_last_existing_product_id(): ?int {
	$last_existing_product_id_array =
		WC()->call_function(
			'wc_get_products',
			array(
				'return'  => 'ids',
				'limit'   => 1,
				'orderby' => array(
					'ID' => 'DESC',
				),
			)
		);

	return empty( $last_existing_product_id_array ) ? null : current( $last_existing_product_id_array );
}