How does first product scan works?

After the first installation of WC Price History you will see the notice informing you the plugin is scanning your products to initialize their prices’ history:

This process will run in the background every time you visit any page in /wp-admin hierarchy.

During each visit, plugin will look for 50 products which does not have prices’ history initiated yet, and will save some initial data: the current price saved with today’s timestamp and the same price related to one day before.

This is required to correctly count history and prevent issue when after you change the price for the first time, it will recognize it immediately as the lowest one.

Every next /wp-admin visit will take next 50 products and set the price for them too. When all products will be scanned, the message will change into information about the success:

You can dismiss this notice at any time, but remember the same notice will be displayed for any logged in wp-admin user, so they will have to dismiss it as well.

Troubleshooting

If you think the notice about ongoing scan process is displayed too long, you can programmatically dismiss it, but I strongly discourage you from doing this. Incomplete history will make your history incorrect!

First, try to make sure every product has the history already set. Remember history is set in the batches of 50 products, so if you have 1000 products it will take 20 wp-admin visits to save history for all of them (1000 / 50 = 20). Refresh your wp-admin at least 20 times and see if the message disappeared.

If it does not go away, use this snippet to check how many non-scanned products you do still have:

global $wpdb;

$non_scanned = $wpdb->get_results(
	$wpdb->prepare(
		"SELECT p.ID
		FROM {$wpdb->posts} p
		LEFT JOIN {$wpdb->postmeta} pm ON p.ID = pm.post_id AND pm.meta_key = %s
		WHERE p.post_type = %s
		AND p.post_status = %s
		AND pm.meta_id IS NULL",
		'_wc_price_history',
		'product',
		'publish'
	)
);

echo count( $non_scanned );
exit();

This should show the number of non scanned products.

If the number is 0 but you still see this notice, you can safely use this snippet to force the notice to disappear:

// REMEMEBER TO RUN THIS ONLY WHEN YOU ARE SURE, 
// THE SCAN IS REALLY DONE!
$settings = get_option( 'wc_price_history_settings' );
$settings['first_history_scan'] = 0;
update_option( 'wc_price_history_settings', $settings );