1

I am importing a product list CSV from a wholesalers website and one of the categories for items is "Baseball Caps" - I have renamed this category to "Hats" but now every time i re-import the product list I have to go rename the category "Hats" back to "Baseball Caps" - run the import - then rename it back, otherwise it will create the new category and all the products to that one instead of the one I would like

Is there a function I could write in wpallimports function editor so that when category == "Baseball Caps" it saves it as "Hats" with slug "Hats" as well ?

thank you

jeff jones
  • 21
  • 1
  • 3

4 Answers4

1

When mapping, under the "Taxonomies, Categories, Tags" section, enable "Product Categories" and you will see an option "Enable Mapping for Product Categories"

In WP All Import under the "Taxonomies, Categories, Tags" section, enable "Product Categories".

Enable the option "Enable Mapping for Product Categories".

In the "In Your File" field input "Baseball Caps" and in the corresponding "Translated To field input "Hats".

Click "Add Another Rule" to add more category mappings.

camber799
  • 11
  • 1
0

Would this work to only replace that string and leave all other strings alone? as there are multiple categories separated by commas. Sorry - haven't scripted since tintin scripting on MUDs a long time ago

[str_replace("Baseball Caps", "Hats", {categories[1]})]
Kirk Beard
  • 9,569
  • 12
  • 43
  • 47
jeff jones
  • 21
  • 1
  • 3
0

WPAllImport has a visual interface for this or use a function : wpai_util_map. See the mapping chapter of the page below

When importing categories, taxonomies, or Custom Fields, you can specify the mapping options using a visual interface. Everywhere else, you can use the wpai_util_map PHP function.

http://www.wpallimport.com/tour/advanced-features/

rebe100x
  • 1,473
  • 15
  • 18
-1
[str_replace("Baseball Caps", "Hats", {name[1]})]  

is it possible to change more strings with this code?

Example:

[str_replace(array("Baseball Caps", "Hats"),array("Second Caps", "Shoes"), {name[1]})]  

Need to change more strings before importing, but my code doesn't work with WP ALLimport.

zte813
  • 95
  • 1
  • 10