Automattic\WooCommerce\Internal\ProductAttributesLookup
DataRegenerator::get_last_existing_product_id()
Get the highest existing product id.
Method of the class: DataRegenerator{}
No Hooks.
Return
Int|null
. Highest existing product id, or null if no products exist at all.
Usage
// private - for code of main (parent) class only $result = $this->get_last_existing_product_id(): ?int;
DataRegenerator::get_last_existing_product_id() DataRegenerator::get last existing product id code WC 9.6.1
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 ); }