• Resolved andrew55

    (@andrew55)


    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

    (@proaktion)

    Hi,

    The op attribute is specified as a parameter on its own – citing from https://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

    (@andrew55)

    The example help me a lot. Thank you very much.

    Thread Starter andrew55

    (@andrew55)

    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.