Home › Forums › General Issues › ACF wp all import add on – How to delete? › Reply To: ACF wp all import add on – How to delete?
Sorry, I’m no php developer which is an issue of course. I’m sort of muddling my way through it, hence why I’m here.
I have a csv for example of 1000 rows. I have a acf repeater (price_comparison) with 5 subfields.
Each row from the csv represents a row for the repeater subfields.
On import of the csv, the result is a table of data which has rows associated by the sku.
Basically a price comparison table.
Each rows has an sku so it knows which product to import to.
When the csv is ran again, the function above updates the subfield “price” if it has changed.
It also checks against subfield “website” to make sure that if there is new data found under the field “website”, which in this case is a new url, then add the new rows data to the product/sku.
The rows that import can never have the same url, so it stops duplicate rows from importing the same url.
What I want the code to do is to check to see if the data exists in the import still and if it doesn’t exist, to delete it.
So basically on update, check price is the same, if price is the same by matching it to “website” then ignore, if it’s changed then update the price.
Never allow a duplicate url (website).
Check if the row still exists and if it doesn’t remove it.
The last part of deletion is the only part it currently does not do with the code above, and yes I am aware that the code above does not contain the delete request as this is the part I’m struggling with.
I am sorry if this doesn’t make sense, as I’ve said. Front end and seo are my areas of expertise , I’ve managed to muddle my way to this stage so I’m not doing too badly 🙂
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!
CPT registration is coming to ACF! We demoed the new feature during the most recent session of ACF Chat Fridays. Check out the summary for the details. https://t.co/k2KQ3WWBAz— Advanced Custom Fields (@wp_acf) March 7, 2023
© 2023 Advanced Custom Fields.