Error when using the if option

Forums Custom Emails for WooCommerce Error when using the if option

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #129376
    Christiaan Grob
    Participant

    Solved it myself. You can not use the if inside the if shortcode but you can do &.

    [if value1=”{order_meta key=’additional_field_681′}” operator=”equal” value2=”Nee” & if value1=”{order_meta key=’additional_field_644′}” operator=”equal” value2=”Locatie_Amstelveen”]

    So it checks of both conditions are applied at the same time

    #129429
    Christiaan Grob
    Participant

    Oh no, I had it wrong, it is not working. It is only checking the first if not the second one, so the & is not working and it is still showing duplicated rows. Would be nice of someone of the support would dive in to this.

    #129976
    Moshtafizur
    Participant

    Hi there,

    I am really sorry to know you are experiencing problems.

    I have escalated this with our development team. They will get back to you as soon as they can.

    Kind regards.

    #130450
    Tom Anbinder
    Moderator
    Plugin Support

    Hi, Christiaan,

    You can neste shortcodes, but not with the same name, so one of the solutions would be to create an alias for the [if] shortcode with a PHP snippet, e.g., [my_if]:

    add_shortcode( 'my_if', function ( $atts, $content = '' ) {
        if ( function_exists( 'alg_wc_custom_emails' ) && isset( alg_wc_custom_emails()->core->shortcodes ) ) {
            return alg_wc_custom_emails()->core->shortcodes->if( $atts, $content );
        }
    } );

    Then you can do this:

    [if][my_if]...[/my_if][/if]

    Please give it a try and let me know what you think.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.