0

I have done this in just vanilla php i.e.: not a wordpress site but I am trying to convert it now which is proving tricky. If a user in puts a prefix of abc and in the quantity field they choose 10, then I have a while statement that just loops through the number of times they inputted and the database values would look like:

abc1
abc2
abc3
abc4
abc5
abc6
abc7
abc8
abc9
abc10

Is there a way to do this in wordpress with advanced custom fields and woo-commerce?

  • how will theses values be used ? – mmm Apr 18 '18 at 19:26
  • They will be used in woo commerce and show as only one product on the frontend (as opposed to having 10 of exactly the same thing) but the quantity of vouchers left will be shown to the user, like "only 10 available" for example and they can add them to their cart. Not sure if that answers your question? – user8463989 Apr 18 '18 at 19:28
  • maybe it will be easier to store a user meta value which match the number of product left. you can use this : codex.wordpress.org/Function_Reference/update_user_meta – mmm Apr 18 '18 at 20:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.