Automattic\WooCommerce\Internal\DataStores\Orders
DataSynchronizer::has_orders_pending_sync
Check if there are orders pending synchronization.
Method of the class: DataSynchronizer{}
No Hooks.
Returns
true|false. True if there are orders pending synchronization, false otherwise.
Usage
$DataSynchronizer = new DataSynchronizer(); $DataSynchronizer->has_orders_pending_sync( $use_cache );
- $use_cache(true|false)
- Whether to use the cached value instead of fetching from database.
Default: false
DataSynchronizer::has_orders_pending_sync() DataSynchronizer::has orders pending sync code WC 10.3.6
public function has_orders_pending_sync( $use_cache = false ) {
if ( $use_cache ) {
$has_pending_sync = wp_cache_get( 'woocommerce_hpos_has_orders_pending_sync', 'counts' );
if ( false !== $has_pending_sync ) {
return (bool) $has_pending_sync;
}
$pending_count = wp_cache_get( 'woocommerce_hpos_pending_sync_count', 'counts' );
if ( false !== $pending_count ) {
return (int) $pending_count > 0;
}
}
$has_pending_sync = $this->query_orders_pending_sync_count( false ) > 0;
wp_cache_set( 'woocommerce_hpos_has_orders_pending_sync', $has_pending_sync, 'counts' );
return $has_pending_sync;
}