{"id":9453,"date":"2021-09-16T20:07:27","date_gmt":"2021-09-16T18:07:27","guid":{"rendered":"https:\/\/www.welaunch.io\/en\/?post_type=faq&p=9453"},"modified":"2024-02-26T19:34:29","modified_gmt":"2024-02-26T18:34:29","slug":"init-variations-after-wp-all-import","status":"publish","type":"faq","link":"https:\/\/www.welaunch.io\/en\/knowledge-base\/faq\/init-variations-after-wp-all-import\/","title":{"rendered":"Init Variations after WP All Import"},"content":{"rendered":"
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:<\/p>\n
function after_xml_import( $import_id, $import ) {\n $admin = new WooCommerce_Single_Variations_Admin('plugin', '1.3.19');\n $admin->init();
$admin->update_variations(false, true);
$admin->reset_transients(false);
}\nadd_action( 'pmxi_after_xml_import', 'after_xml_import', 10, 2 );\n<\/pre>\nThis will ensure all variations are reinitiated after import.<\/p>\n","protected":false},"author":1,"featured_media":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","product_cat":[],"class_list":["post-9453","faq","type-faq","status-publish","hentry","faq_topics-show-single-variations","faq_topics-single-variations-faq"],"_links":{"self":[{"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/faq\/9453","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/faq"}],"about":[{"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/types\/faq"}],"author":[{"embeddable":true,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/comments?post=9453"}],"version-history":[{"count":3,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/faq\/9453\/revisions"}],"predecessor-version":[{"id":17340,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/faq\/9453\/revisions\/17340"}],"wp:attachment":[{"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/media?parent=9453"}],"wp:term":[{"taxonomy":"product_cat","embeddable":true,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/product_cat?post=9453"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}