The problem is that the values are stored in the wrong place, associated with a post instead of a term. Because WPAI was used for the import the fields have the correct key associations. So the first reply, while it can cause issues is not really the problem.
What you would need to do to correct the situation using the data as it exists.
1) Get all of the products
2) Figure out what product category these values were supposed to be applied to
3) Get these fields from the product
4) update the field using the correct term id
The problem here is going to be figuring out #2.
– What categories is the product assigned to?
– Is there more than one category?
– Where the values imported to posts more than one time, i.e. where the same values added to multiple posts in the category?
– If the product is in multiple categories then which category were the values really meant for?
Because of these questions, and the additional questions that the answers would probably create, it’s really hard to give any meaningful way to resolve the problem.
If this was me I would create a field group for the categories and then I’d create to proper import to import these meta values to the categories and I would just ignore the data that was created in the wrong way…. or find an way to just delete it all from the database, rather than try to transform the data that is stored improperly.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
© 2022 Advanced Custom Fields.