wc_update_product_lookup_tables_rating_count( array $rows )
Populate rating count lookup table data for products.
Description Description
Parameters Parameters
- $rows
-
(Required) Rows of rating counts to update in lookup table.
Source Source
File: includes/wc-product-functions.php
function wc_update_product_lookup_tables_rating_count( $rows ) {
if ( ! $rows || ! is_array( $rows ) ) {
return;
}
global $wpdb;
foreach ( $rows as $row ) {
$count = array_sum( (array) maybe_unserialize( $row['meta_value'] ) );
$wpdb->update(
$wpdb->wc_product_meta_lookup,
array(
'rating_count' => absint( $count ),
),
array(
'product_id' => absint( $row['post_id'] ),
)
);
}
}
Changelog Changelog
| Version | Description |
|---|---|
| 3.6.0 | Introduced. |