• Hello.

    I am trying to import products in my database and I am struggling with the category mapping in WooCommerce. Everything else is working fine.

    I imported the category in wp_terms and wp_term_taxonomy,
    mapped the product in wp_terms-relationships to the category,
    changed the count in wp_term_taxonomy and the meta_value in wp_termmeta

    but still not working.

    In the Backend the category is showing up in the product list, but if I open the product, no category is chosen. Any idea, what is missing?

    Thank you very much

    https://ww.wp.xz.cn/plugins/woocommerce/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Mike Jolley

    (@mikejolley)

    Have you flushed the term cache?

    https://developer.ww.wp.xz.cn/reference/functions/wp_cache_flush/

    Also you need to ensure the taxonomy is correct. product_cat.

    Thread Starter ali1993esoterik

    (@ali1993esoterik)

    Where do I have to insert this? In my Cronjob or in my functions.php?

    The taxonomy is correct. The category shows up, but no products are in it.

    Plugin Contributor Mike Jolley

    (@mikejolley)

    This would be after your import code.

    You could have course also use real WP functions such as wp_insert_term

    Thread Starter ali1993esoterik

    (@ali1993esoterik)

    Thank your for your help, but it is still not working. Included the Function in the end of my Cronjob. Everything has been imported correctly.

    function wp_cache_flush() {
        global $wp_object_cache;
    
        return $wp_object_cache->flush();
    }

    If I click in the Backend on Products > Categories and on the number besides a category (count) it shows me the product, which is mapped to the category, but when I open the category in frontend, there are no products in it…

    I don’t know how the wp_insert_term should help me, because the category shows up in my backend without any problem. Also the product shows up in backend, when i open the count in category. The only problem is the frontend..

    Do you have any other idea?

    Thank you very much.

    Plugin Contributor Mike Jolley

    (@mikejolley)

    Huh, why did you not use the actual WP function?

    If it’s not available during your cron job, run it on your WP site afterwards. The global may not be available.

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

The topic ‘Categories saved in database’ is closed to new replies.