When you use automatic product imports via WP All import for example, you have to manually init variations every time. As this is quite annoying please add the following code into your functions.php:

 function after_xml_import( $import_id, $import ) {
    $admin = new WooCommerce_Single_Variations_Admin('plugin', '1.3.19');
$admin->update_variations(false, true);
} add_action( 'pmxi_after_xml_import', 'after_xml_import', 10, 2 );

This will ensure all variations are reinitiated after import.

6 thoughts on “Init Variations after WP All Import

  1. Shoaib says:

    Currently When I am manually doing the INIT it is stuck at some point and not showing all the products variations on the front, what will be a quick fix for that? cant do the import again.

  2. Efthimios says:

    I am getting the following error with this hook.

    AH01071: Got error ‘PHP message: PHP Fatal error: Uncaught TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, function “_update_posts_count_on_transition_post_status” not found or invalid function name

    Could you check it?

    Thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *