Title: Pre-processing the XML File
Last modified: October 11, 2020

---

# Pre-processing the XML File

 *  Resolved [RayZorJ3lade](https://wordpress.org/support/users/rayzorj3lade/)
 * (@rayzorj3lade)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/pre-processing-the-xml-file/)
 * I’m trying to integrate API-based stock and pricing with my new product/product
   variations imports.
 * My first idea was to use functions to make API calls for Stock and Price at the
   time of import, works fine for simple products but not for variations, probably
   because the API calls are pretty slow to respond.
 * So my new plan is to use ‘pmxi_before_xml_import’ to pre-process the xml file,
   do a bulk stock and price query and inject the values into the xml before the
   import starts.
 * I know the action works like this:
 *     ```
       function wp_all_import_before_xml_import( $import_id ) {
           // Unless you want this code to execute for every import, check the import id
           // if ($import_id == 5) { ... }
       }
   
       add_action('pmxi_before_xml_import', 'wp_all_import_before_xml_import', 10, 1);
       ```
   
 * But how do I actually access the xml from within that function?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [WP All Import](https://wordpress.org/support/users/wpallimport/)
 * (@wpallimport)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/pre-processing-the-xml-file/#post-13558644)
 * Hi [@rayzorj3lade](https://wordpress.org/support/users/rayzorj3lade/),
 * There is an example snippet here showing how to access and modify the XML file
   with this hook: [https://www.wpallimport.com/documentation/developers/code-snippets/#access-data-above-element-chosen-on-step-2](https://www.wpallimport.com/documentation/developers/code-snippets/#access-data-above-element-chosen-on-step-2).
 *  Plugin Author [WP All Import](https://wordpress.org/support/users/wpallimport/)
 * (@wpallimport)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/pre-processing-the-xml-file/#post-13592667)
 * Hi [@rayzorj3lade](https://wordpress.org/support/users/rayzorj3lade/),
 * I’m going to go ahead and mark this as resolved since we haven’t heard back in
   a while. You can still follow up in this thread if you still have questions.
 * Anyone else, please open a new topic.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Pre-processing the XML File’ is closed to new replies.

 * ![](https://ps.w.org/wp-all-import/assets/icon-256x256.png?rev=2570179)
 * [WP All Import – Drag & Drop Import for CSV, XML, Excel & Google Sheets](https://wordpress.org/plugins/wp-all-import/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-all-import/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-all-import/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-all-import/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-all-import/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-all-import/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [WP All Import](https://wordpress.org/support/users/wpallimport/)
 * Last activity: [5 years, 7 months ago](https://wordpress.org/support/topic/pre-processing-the-xml-file/#post-13592667)
 * Status: resolved