Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter hesambackend

    (@hesambackend)

    Hi, I hope you are doing well.
    I found something related to this code and the WooCommerce system.

    My code is running correctly, but in order to rebuild the shop filters, I created a duplicate of the product and then removed the original one so the newly added product would be reflected in the shop filters.

    However, I think the problem is related to updating WooCommerce products. Even after running all the code snippets above, the shop filters still do not work properly.
    Do you think there is a better way to handle this issue?

    Thread Starter hesambackend

    (@hesambackend)

    I used the wc_update_product_lookup_tables function after wp_set_post_terms, but it still didn’t work.
    However, I noticed something: when I open the product edit page in the admin panel and click the Update button, the product then appears correctly in the shop filters.

    After discovering this, I went back to my code and added wp_update_post after wp_set_post_terms inside my loop, hoping to refresh the filters after setting the new terms, but it still didn’t work.

    Update reply ——————–

    I checked the wc_product_attributes_lookup table and filtered all records that matched my product ID. I noticed that pa_color was still pointing to the previous term ID and had not been updated to the new term ID that I set.

    Now, to fix this issue, should I manually update this value in the table, or is there a function that handles this automatically?

    • This reply was modified 5 months, 3 weeks ago by hesambackend.
    Thread Starter hesambackend

    (@hesambackend)

    Thanks for your help.
    But after all this, the shop filters still don’t show the products.

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