Loop for custom fields
-
Hi there,
I’m wanting to add columns to the CSV exported file with the names of the customers.
On the website I’m working a customer can buy X amount of tickets, and whenever the user buys more than 1 ticket it generates a loop to add the names to each person the tickets are for.
So for example: John buys 2 tickets, and on the checkout he can put down that the tickets are for John (himself) and for Mary. The names are saved to the database.However, I can’t picture exactly how to add these “extra names” to the CSV file, as these would be in a loop and they can be any number of extra names (user can buy whatever number of tickets they want/need).
I can’t add one(1) key for each extra name to the “Order Export Settings”, because I’m never going to know what’s the maximum number of tickets any of the users bought. So the way I see this would have to be only one checkbox, say “Extra Names”, and if that’s checked than the csv_write would bring (loop) all the extra names for each order (Extra Name 1, Extra Name 2, etc etc).
Has anyone tried to add columns using a for loop? Is it doable? Could anyone enlighten me on this idea?
Thanks anyone for any help, all very appreciated.
https://www.ads-software.com/plugins/woocommerce-simply-order-export/
- The topic ‘Loop for custom fields’ is closed to new replies.