Title: Making Rules for XML (HELP PLS!)
Last modified: November 9, 2020

---

# Making Rules for XML (HELP PLS!)

 *  Resolved [headplus](https://wordpress.org/support/users/headplus/)
 * (@headplus)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/making-rules-for-xml-help-pls/)
 * Hi!
 * I’m trying to make an xml file with some rules and i need your help!
 * I have some products (woocommerce) and i want to export them but i want to change
   some data on XML…
 * For example:
    2 products have in taxonomy the brand ”COLGATE” and 3 products 
   have in taxonomy the brand ”COLGATEFORKIDS”
 * because the manufacturer is the ”PROCT&GRAMBLE” for both of them,
 * how to indicate on XML for this 5 products as brand ”PROCT&GRAMBLE” ???
 * Thank you in Advanced!

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

 *  Plugin Author [WP All Import](https://wordpress.org/support/users/wpallimport/)
 * (@wpallimport)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/making-rules-for-xml-help-pls/#post-13645536)
 * Hi [@headplus](https://wordpress.org/support/users/headplus/),
 * Just to clarify, are you saying that you want to do something like this:
 *     ```
       IF brand is "COLGATE" 
       OR brand is "COLGATEFORKIDS" 
       AND manufacturer is "PROCT&GRAMBLE"
       Return "PROCT&GRAMBLE" as the brand
   
       ELSE
       Return whatever is in the brand taxonomy.
       ```
   
 * Or, am I misunderstanding?
 *  Thread Starter [headplus](https://wordpress.org/support/users/headplus/)
 * (@headplus)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/making-rules-for-xml-help-pls/#post-13646105)
 * [@wpallimport](https://wordpress.org/support/users/wpallimport/) yes that’s it!
   You got it! :))
    What function I have to make? (Because I tryied something without
   results)
 *  Plugin Author [WP All Import](https://wordpress.org/support/users/wpallimport/)
 * (@wpallimport)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/making-rules-for-xml-help-pls/#post-13670105)
 * Hi [@headplus](https://wordpress.org/support/users/headplus/),
 * Okay, you’ll definitely need to write a function for that: [https://www.wpallimport.com/documentation/export/pass-data-through-php-functions/](https://www.wpallimport.com/documentation/export/pass-data-through-php-functions/).
   Here is an example that you can modify as needed:
 *     ```
       function my_get_brand( $brand, $manufacturer ) {
           if ( ( $brand == 'COLGATE' || $brand == 'COLGATEFORKIDS' ) && $manufacturer == 'PROCT&GRAMBLE' ) {
               return 'PROCT&GRAMBLE';
           } else {
               return $brand;
           }
       }
       ```
   
 * This would be used in a [Custom XML Feed](https://www.wpallimport.com/documentation/export/xml-format/)
   like this:
 * `<brand>CDATABEGIN[my_get_brand({Brands},{Manufacturers})]CDATACLOSE</brand>`
 * This includes CDATA tags because of the ampersand, just be sure to replace {Brands}
   and {Manufacturers} with the correct export elements on your site.
 *  Thread Starter [headplus](https://wordpress.org/support/users/headplus/)
 * (@headplus)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/making-rules-for-xml-help-pls/#post-13671083)
 * I ‘ m really grateful for your reply!!!
    **Thanks a lot!!!!**

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

The topic ‘Making Rules for XML (HELP PLS!)’ is closed to new replies.

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

## Tags

 * [export products](https://wordpress.org/support/topic-tag/export-products/)
 * [rules](https://wordpress.org/support/topic-tag/rules/)
 * [xml](https://wordpress.org/support/topic-tag/xml/)

 * 4 replies
 * 2 participants
 * Last reply from: [headplus](https://wordpress.org/support/users/headplus/)
 * Last activity: [5 years, 5 months ago](https://wordpress.org/support/topic/making-rules-for-xml-help-pls/#post-13671083)
 * Status: resolved