This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: SKU Search not working on newly imported and indexed products

Home Forums Product Support Forums Ajax Search Pro for WordPress Support SKU Search not working on newly imported and indexed products Reply To: SKU Search not working on newly imported and indexed products

#33681
Ernest MarcinkoErnest Marcinko
Keymaster

Hi,

I assume the SKU field is added later on during the import. So the import probably creates the product, then saves it – at that point the item is already indexed. Then adds the custom field, which does not trigger the re-indexing.

If the regular update or add post meta functions are used for the indexing, then maybe a custom code could work.

add_action( 'updated_post_meta', 'asp_force_index_on_meta_save', 10, 2 );
add_action( 'added_post_meta', 'asp_force_index_on_meta_save', 10, 2 );
function asp_force_index_on_meta_save( $meta_id, $object_id ) {
	$o = new WD_ASP_IndexTable_Action();
	$o->update( $object_id, null, true );
}

Try adding this code to the functions.php file in your theme/child theme directory – make sure to have a full server back-up first for safety. For more details you can check the safe coding guidelines.

Note, that this should only start working on new imports.