Conditional Fields to send mail not working
-
Hi,
I have configured a conditional field in the contact form. The field
"aan:"has options such as"Verhuur"and"Test". When one of those options is selected, an additional field appears:"Locatie:".The conditional logic works correctly on the frontend – the
"Locatie"field only shows when the condition is met.However, the conditional mail tag in the email template does not work as expected. I only want the
"Locatie"field to appear in the email if it was shown and filled out. Instead, the entire conditional block is omitted in the email, even when the condition was met and the location field was visible and filled in.Current mail template snippet:
[conditional-location]
[location]
[/conditional-location]Expected Result:
If the conditional field"aan:"is set to"Verhuur"or"Test"and"Locatie"is filled in, then the output in the email should be:Locatie: [value of location]Actual Result:
The email output is completely empty – no"Locatie"line appears, even when the condition is met and the field is filled.Notes:
The conditional field displays correctly on the website.
The issue seems to be specific to conditional mail tag rendering in the email template.Environment:
WordPress version: v6.7.2
Plugin version: Ultimate Addons for Contact Form 7 v3.5.8
Theme: Avada
PHP version: v8.1.31The page I need help with: [log in to see the link]
The topic ‘Conditional Fields to send mail not working’ is closed to new replies.