Automattic\WooCommerce\Internal\DataStores\Orders
DataSynchronizer::get_current_orders_pending_sync_count
Calculate how many orders need to be synchronized currently. A database query is performed to get how many orders match one of the following:
- Existing in the authoritative table but not in the backup table.
- Existing in both tables, but they have a different update date.
Method of the class: DataSynchronizer{}
No Hooks.
Returns
null. Nothing (null).
Usage
$DataSynchronizer = new DataSynchronizer(); $DataSynchronizer->get_current_orders_pending_sync_count( $use_cache ): int;
- $use_cache(true|false)
- Whether to use the cached value instead of fetching from database.
Default:false
DataSynchronizer::get_current_orders_pending_sync_count() DataSynchronizer::get current orders pending sync count code WC 10.7.0
public function get_current_orders_pending_sync_count( $use_cache = false ): int {
if ( $use_cache ) {
$pending_count = wp_cache_get( 'woocommerce_hpos_pending_sync_count', 'counts' );
if ( false !== $pending_count ) {
return (int) $pending_count;
}
}
$pending_count = $this->query_orders_pending_sync_count();
wp_cache_set( 'woocommerce_hpos_pending_sync_count', $pending_count, 'counts' );
return $pending_count;
}