woocommerce_hpos_enable_sync_on_read filter-hookWC 8.1.0

Allow opportunity to disable sync on read, while keeping sync on write enabled. This adds another step as a large shop progresses from full sync to no sync with HPOS authoritative. This filter is only executed if data sync is enabled from settings in the first place as it's meant to be a step between full sync -> no sync, rather than be a control for enabling just the sync on read. Sync on read without sync on write is problematic as any update will reset on the next read, but sync on write without sync on read is fine.

Usage

add_filter( 'woocommerce_hpos_enable_sync_on_read', 'wp_kama_woocommerce_hpos_enable_sync_on_read_filter' );

/**
 * Function for `woocommerce_hpos_enable_sync_on_read` filter-hook.
 * 
 * @param bool $read_on_sync_enabled Whether to sync on read.
 *
 * @return bool
 */
function wp_kama_woocommerce_hpos_enable_sync_on_read_filter( $read_on_sync_enabled ){

	// filter...
	return $read_on_sync_enabled;
}
$read_on_sync_enabled(true|false)
Whether to sync on read.

Changelog

Since 8.1.0 Introduced.

Where the hook is called

OrdersTableDataStore::read_multiple()
woocommerce_hpos_enable_sync_on_read
woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php 1241
$data_sync_enabled = apply_filters( 'woocommerce_hpos_enable_sync_on_read', $data_sync_enabled );

Where the hook is used in WooCommerce

Usage not found.