Conditional Rendering of E2PDF Shortcodes in Gravity Forms Confirmation Email

May 22, 2025 08:29:59
AirBelV2
Topics: 5
Messages: 19
Hi E2PDF team,

I have a Gravity Forms entry that stores a JSON payload in field (68). This json describes whether the trip is one-way or return, how many passengers, and the details of each flight segment (including “IsReturn” and stop counts).

What I need is to display one PDF download button per passenger per segment in my Gravity Forms confirmation email by using your [e2pdf-download id="…"] shortcode. For example:

One-way, 3 passengers, direct:
[e2pdf-download id="4"] [e2pdf-download id="10"] [e2pdf-download id="11"]

Return, 5 passengers, outbound with stop + inbound direct:
[e2pdf-download id="2"] … [e2pdf-download id="21"] and [e2pdf-download id="5"] … [e2pdf-download id="9"]

Hard-coding the shortcodes in the email editor works fine, but when I generate them dynamically in PHP (using gform_pre_send_email or gform_notification), they never render or get stripped out.

Do you have a recommended approach or example for:

Forcing E2PDF shortcodes to render when injected programmatically into a Gravity Forms notification?

A PHP function or API to get the download links directly (so I can build my own buttons)?

Any pointers or code snippets would be a huge help.

Thanks in advance,
Enzo
May 22, 2025 08:38:01
E2Pdf
Topics: 7
Messages: 3614
Support
Hello,

When E2Pdf shortcodes are called programmatically (via PHP), it is mandatory to set the "dataset" attribute, which corresponds to the Gravity Forms Entry ID (in case the E2Pdf Template is connected to Gravity Form)

echo do_shortcode('[e2pdf-download id="3" dataset="' . $entry_id . '"]');

We would really appreciate your feedback at WordPress.org!
May 22, 2025 08:41:16
E2Pdf
Topics: 7
Messages: 3614
Support
P.S. If you need to build your own buttons, it's possible to output just the URLs by using the "output" attribute: https://e2pdf.com/docs/shortcodes/e2pdf-download#basic

Example:

[e2pdf-download id="1" output="url"] or [e2pdf-download id="1" output="url_raw"]

If called via PHP, the "dataset" attribute is still mandatory.

We would really appreciate your feedback at WordPress.org!
May 23, 2025 06:08:43
AirBelV2
Topics: 5
Messages: 19
That's perfect, thank you very much! I hadn’t added the dataset attribute. Thanks again for your quick response.
Get News and Updates
Our monthly newsletter keeps you in the loop, so you'll always be up to date with the latest news and updates about E2Pdf.
* You can update your email subscription preferences here.
All trademarks, service marks, trade names, product names, and logos appearing on this website are the property of their respective owners. The use of trademarks such as Formidable Forms®, Forminator Forms®, Gravity Forms®, JetFormBuilder®, WordPress®, WooCommerce®, WPForms® and others is solely for identification purposes (nominative use) and does not imply any affiliation, sponsorship, or endorsement by the respective trademark holders.
© 2017 - 2026, https://e2pdf.com

We use cookies to collect and analyse information on site performance and usage, to provide social media features and to enhance and customise content and advertisements. By clicking "Accept Selected", you consent to use of selected cookies according to our Cookie Policy.