Title: OR &amp; AND operations
Last modified: October 19, 2018

---

# OR & AND operations

 *  Resolved [andrew55](https://wordpress.org/support/users/andrew55/)
 * (@andrew55)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/or-and-operations/)
 * In your documentation, you state this;
 * > “op : (optional) The operation applied to evaluate the validity, and (default)
   > as well as or are accepted. Indicating op=”and” requires all codes to be applied,
   > op=”or” requires at least one to be applied.”
 * I haven’t been able to find examples of the exact syntax for applying this. Would
   it be something like:
 *     ```
       [coupon_is_applied op="COUPON1andCOUPON2"]
       Will display only if COUPON1 and COUPON2 exist
       [/coupon_is_applied]
       ```
   
 * Also, will “nesting” work with shortcodes, such as:
 *     ```
       [coupon_is_not_applied code="COUPON3"]
       [coupon_is_applied op="COUPON1andCOUPON2"]
       Will display only if COUPON1 and COUPON2 exist, and only if COUPON3 is not applied
       [/coupon_is_applied]
       [/coupon_is_applied]
       ```
   
 * Or, is there another different syntax to create this type of condition.
 * Thank you very much for the great plugin and for any clarification.

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

 *  Plugin Contributor [Kento](https://wordpress.org/support/users/proaktion/)
 * (@proaktion)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/or-and-operations/#post-10918873)
 * Hi,
 * The `op` attribute is specified as a parameter on its own – citing from [http://docs.itthinx.com/document/woocommerce-coupon-shortcodes](http://docs.itthinx.com/document/woocommerce-coupon-shortcodes):
 * > Indicating op=”and” requires all codes to be applied, op=”or” requires at least
   > one to be applied.
 * So for example, you could do:
 * `[coupon_is_applied code="apple,vinegar" op="or"]...[/coupon_is_applied]`
 * … to show the content, whether the coupon apple or the coupon vinegar is valid.
 * I hope this is still helpful!
 *  Thread Starter [andrew55](https://wordpress.org/support/users/andrew55/)
 * (@andrew55)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/or-and-operations/#post-10942867)
 * The example help me a lot. Thank you very much.
 *  Thread Starter [andrew55](https://wordpress.org/support/users/andrew55/)
 * (@andrew55)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/or-and-operations/#post-10943420)
 * A question about using op attribute – I have this shortcode:
 * `[coupon_is_not_valid code="coupon1,coupon2" op="or"]show if no coupons[/coupon_is_not_valid]`
 * It seems like it should show text “show if no coupons” if coupon1 or coupon2 
   is not valid, but when the coupons are not valid, the shortcode text does not
   show. It never shows whether coupons are valid or not.
 * Any suggestions for the proper syntax to get this working properly?
 * Thanks for any help.

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

The topic ‘OR & AND operations’ 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

 * [and](https://wordpress.org/support/topic-tag/and/)
 * [code](https://wordpress.org/support/topic-tag/code/)
 * [Codes](https://wordpress.org/support/topic-tag/codes/)
 * [logic](https://wordpress.org/support/topic-tag/logic/)
 * [operator](https://wordpress.org/support/topic-tag/operator/)
 * [or](https://wordpress.org/support/topic-tag/or/)

 * 3 replies
 * 2 participants
 * Last reply from: [andrew55](https://wordpress.org/support/users/andrew55/)
 * Last activity: [7 years, 4 months ago](https://wordpress.org/support/topic/or-and-operations/#post-10943420)
 * Status: resolved