Fix: using "current" on a possibly "false" value.
This commit is contained in:
parent
44cf1648d5
commit
e58d26f377
|
@ -155,7 +155,7 @@ CREATE TABLE ' . $this->lookup_table_name . '(
|
|||
);
|
||||
// phpcs:enable WordPress.DB.PreparedSQL.NotPrepared
|
||||
|
||||
$last_existing_product_id = current(
|
||||
$last_existing_product_id =
|
||||
wc_get_products(
|
||||
array(
|
||||
'return' => 'ids',
|
||||
|
@ -163,14 +163,14 @@ CREATE TABLE ' . $this->lookup_table_name . '(
|
|||
'orderby' => 'id',
|
||||
'order' => 'DESC',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
if ( false === $last_existing_product_id ) {
|
||||
// No products exist, nothing to (re)generate.
|
||||
return false;
|
||||
}
|
||||
|
||||
update_option( 'woocommerce_attribute_lookup__last_product_id_to_process', $last_existing_product_id );
|
||||
update_option( 'woocommerce_attribute_lookup__last_product_id_to_process', current( $last_existing_product_id ) );
|
||||
update_option( 'woocommerce_attribute_lookup__last_products_page_processed', 0 );
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue