Dynamic Shortcode Field Values

I’m hoping to pick the brains of someone smarter than me.

We are auto-generating about 300 posts on a wordpress site and we’d like to set the page template up so a single gravityform (id #1) is populated with field_values from an ACF custom field on the specific post. The problem I’m running into is that I can not put a GF Shortcode on a post and populate the field_value from another field.

For example our specific use case is using Gravity forms for a donation page, however we have about 300 different funds which each requires its own form. Therefore, Fund #1’s shortcode would be [gravityforms id=“1” field_values=“SKU=SKU1111”] where SKU1111 needs to pull from an ACF Custom Field on that specific post.

What would be the easiest way to accomplish this as I found I can’t replace SKU1111 with the ACF shortcode because nested shortcodes don’t work.

We’re currently using WPBakery with Templetera for the GUI on the page and I’d like to stay away from creating a custom coded post page (which I know can accomplish this) as we may want to change some elements and don’t really want to have to code it every time.

Thoughts? Thanks in advance.

If each post has the value stored in a custom field with the ACF (or any other) key of “SKU” you can use this merge tag as Default Value (on the Advanced tab of the field in the form builder) for the field you want to populate:

{custom_field:SKU}

There’s no need for more than one form and no code required and nothing special required in the [gravityforms] shortcode.

Documentation:

1 Like

No way! I totally overlooked that. Thanks for the easy solution.

I hope that works out for you. If you need more assistance, just let us know.

Chris,
Do you know if there’s a simple solution to dynamically populate in the Field Label in the same fashion? It seems like the code you mentioned doesn’t work in that field.

Thanks!

You can’t populate the field label in the same way. To populate the label will require code. How about if you start a new topic and we’ll discuss it there? Thank you.