Title: Random code
Last modified: August 28, 2018

---

# Random code

 *  Resolved [w3arts](https://wordpress.org/support/users/w3arts/)
 * (@w3arts)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/random-code-3/)
 * Hello,
 * thanks for you create plugin.
 * We generated 10 coupon code in WooCommerce and want to show a valid random code
   on a post page, so each visitor see another code. It this possible?
 *     ```
       [coupon_enumerate code="*" type="percent"]
       [coupon_discount element_tag="div" prefix="code"]
       [/coupon_enumerate]
       ```
   
 * Shows all the time all available codes.
 * Thank you so much

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Contributor [Kento](https://wordpress.org/support/users/proaktion/)
 * (@proaktion)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/random-code-3/#post-10637141)
 * Hi,
 * Thanks for asking!
 * At current, this is not possible as you will either have to specify existing 
   coupon codes explicitly or, as you have outlined in the example, use the * wildcard
   to iterate over all.
 * But … if it supported a rand value for the order attribute and an additional 
   limit attribute, then that would be possible. With that, we could do something
   like:
 *     ```
       [coupon_enumerate code="*" order="rand" "limit="1" type="percent"]
       ...
       [/coupon_enumerate]
       ```
   
 * The above is **not** possible in the current latest version (1.6.2) but let me
   check if it’s easy to implement and we’ll issue an update.
 * Cheers
    -  This reply was modified 7 years, 9 months ago by [Kento](https://wordpress.org/support/users/proaktion/).
      Reason: fixed shortcode example
 *  Plugin Contributor [Kento](https://wordpress.org/support/users/proaktion/)
 * (@proaktion)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/random-code-3/#post-10918866)
 * Added support for this (randomized) in version 1.7.0 with the shortcode [coupon_enumeration]–
   example:
 *     ```
       [coupon_enumerate code="*" orderby="rand" number="3"]
       [coupon_show show="code,description,discount"]
       [/coupon_enumerate]
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Random code’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce-coupon-shortcodes/assets/icon-256x256.png?rev
   =3238009)
 * [Coupon Shortcodes for WooCommerce](https://wordpress.org/plugins/woocommerce-coupon-shortcodes/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce-coupon-shortcodes/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-coupon-shortcodes/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-coupon-shortcodes/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-coupon-shortcodes/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-coupon-shortcodes/reviews/)

## Tags

 * [list](https://wordpress.org/support/topic-tag/list/)
 * [order](https://wordpress.org/support/topic-tag/order/)
 * [rand](https://wordpress.org/support/topic-tag/rand/)

 * 2 replies
 * 2 participants
 * Last reply from: [Kento](https://wordpress.org/support/users/proaktion/)
 * Last activity: [7 years, 6 months ago](https://wordpress.org/support/topic/random-code-3/#post-10918866)
 * Status: resolved