You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I currently use the form shortcode to embed forms in WP pages. All good. However, I have a lot of product pages that all need effectively the same form on it, the only thing that varies is the product page it is on.
Ideally what I'd like is to be able to have a hidden field in the form that indicates product name. Then when I embed the form I could set that field in the shortcode. Then in the campaign behind the form I can check that field value and do the product specific different behaviours.
Is this possible? The alternative seems to be having one form per product page, which works but is a lot of duplication for each product.
If you are not afraid to write some code it's possible yes :-)
Currently, this plugin is "just" providing some shortcodes and interpret them only in the post content but you can use those shortcodes outside of the post body itself.
You'll need to update your product page PHP template to inject the shortcode in it (and interpret it). Since you'll need to automate script injection, you have 2 choices.
For example a code like this can work anywhere in your PHP code when you have the Mautic plugin activated :
Thanks @shulard. I don't mind writing a bit of code if needed, but I think I need a bit more of a hint, sorry.
I can see how the shortcode injects the script tag with the form id, but can't see how to set the value of the field. Are there additional attributes I should pass into it to do that? Any pointers to other places in the code that might make it clearer?
I currently use the form shortcode to embed forms in WP pages. All good. However, I have a lot of product pages that all need effectively the same form on it, the only thing that varies is the product page it is on.
Ideally what I'd like is to be able to have a hidden field in the form that indicates product name. Then when I embed the form I could set that field in the shortcode. Then in the campaign behind the form I can check that field value and do the product specific different behaviours.
Is this possible? The alternative seems to be having one form per product page, which works but is a lot of duplication for each product.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: