Hi @juriix,
I can see that we’ve already been working on this issue with you via our support system, so let’s continue the discussion there to avoid confusion.
Hi,
I am interested in this Solution, too.
regards
Wolfgang
Thread Starter
juriix
(@juriix)
Hello,
add this in All Import -> Settings
//Map categories
function my_translate_category($category) {
if($category === 'Kids > Shoes') {
return 'Kids & Baby';
} else {
return 'Nezařazené';
}
}
But I don’t know how to import into subcategories that are already in the system.
Regards
-
This reply was modified 4 years, 4 months ago by
juriix.
Hi,
thank you, I will try this…
regards
Thread Starter
juriix
(@juriix)
Hello,
I don’t know why some content doesn’t want to import under mapped categories.
E.g. the product “Adidas L” should be imported into “kids-baby”, but imported into “Uncategorized”.
Path from feed – Kids > Shoes > Sport, Run
} elseif($category === 'Kids') {
return 'kids-baby';
Kids (main category) has subcategories Shoes > Sport, Run
Since I tested the feed I thought that if the Product has only the main category it will be imported OK, but if the product has subcategories the content will be imported into “uncategorized”. Could it be that the import is set as “Each Post has just one Rubric” (Each Příspěvek has just one Rubrika)? If so, how to set the import to import the content with Subcategories into the correct Rubrics (categories) as well?
Thank you.
Hi @juriix,
That’s happening because “Kids > Shoes > Sport, Run” does not === “Kids”. You’d have to update your code to use strpos() or something similar to see if “Kids” exists in the string, rather than looking for an exact match.
Thread Starter
juriix
(@juriix)
Hello,
I have created this for POST
add_filter('wp_all_import_is_post_to_create', 'my_is_post_to_create', 10, 3);
//Map categories
function my_translate_category($category) {
if(strpos($category, 'Shoes') !== false) {
return 'kids-baby';
but for Woocommerce Products it doesn’t work, Can you help me?
Thank you