Hmmm… this could be tricky.
First… have a peek through this thread here.
You will see that.. in order to pre-populate a repeater, the rows will have to exist ahead of time.
1) You had a ‘codename’ text field.
2) You had a ‘howmany’ number field (to decide how many codes to generate).
3) You had a textarea field to store your coupons…
… you could store them one per line (and just ‘append’ them when you add more), and then separate the data with a “pipe” | symbol to deal with later. You can use the PHP explode() function to split the data by the “pipe” symbol.
Here’s a page that describes how to extract each line from a textarea field. Then, of course, use ‘explode’ to separate the data from each line.
Hope that helps. There may be a better way, it’s just not coming to me if so 🙂
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!