wc_update_product_lookup_tables_rating_count_batch( array $offset, array $limit )
Populate a batch of rating count lookup table data for products.
Description Description
Parameters Parameters
- $offset
-
(Required) Offset to query.
- $limit
-
(Required) Limit to query.
Source Source
File: includes/wc-product-functions.php
function wc_update_product_lookup_tables_rating_count_batch( $offset = 0, $limit = 0 ) { global $wpdb; if ( ! $limit ) { return; } $rating_count_rows = $wpdb->get_results( $wpdb->prepare( " SELECT post_id, meta_value FROM {$wpdb->postmeta} WHERE meta_key = '_wc_rating_count' AND meta_value != '' AND meta_value != 'a:0:{}' ORDER BY post_id ASC LIMIT %d, %d ", $offset, $limit ), ARRAY_A ); if ( $rating_count_rows ) { wc_update_product_lookup_tables_rating_count( $rating_count_rows ); WC()->queue()->schedule_single( time() + 1, 'wc_update_product_lookup_tables_rating_count_batch', array( 'offset' => $offset + $limit, 'limit' => $limit, ), 'wc_update_product_lookup_tables' ); } }
Changelog Changelog
Version | Description |
---|---|
3.6.2 | Introduced. |