Custom form submission when adding product to cart

Hi There,
I'd like to submit a form via email when a user adds a product to the cart. I've set up the custom forms using the Formidable plugin to collect additional information to fill orders. I'd like this form to submit via email. Is there a way to do this? Or is there a better way?

Right now, on the site, if I place the form on the product page, users will have to click two buttons "Submit" for the form and "Add to Cart" to initiate the purchase.

  • Patrick
    • Support Monkey

    Hi there @shannon

    Welcome to WPMU DEV, glad to have you aboard!

    Yes, it should be possible to trigger an email for the Formidable form by hooking the email action in Formidable to the purchase action in the MarketPress cart.

    I don't think you'd want to hook it to to any add-to-cart action, otherwise you may get swamped by emails from users who don't complete a purchase.

    However, regardless of which MarketPress action the email is hooked onto, and even though you can set the form to not save entries, you're still going to wind up with an entry for each time the Formidable form is filled out by a user.

    I believe saving the entries would be necessary for those shoppers who like to keep browsing around & shopping for other stuff after they've added a product to their cart.

    I also wonder if there may be a way to actually replace the "Personalize" field in the cart with your custom form.

    At any rate, as this type of custom integration is a wee bit over my head, we'd need a bit of help from more code-savvy support staff.

    Perhaps my colleague @Ashok would like to have a play with this one?

  • Ash
    • WordPress Hacker

    Hello @shannon

    I hope you are well today.

    I have just checked your product page, but didn't see any form. Would you please share me a link so that I can check?

    Also, let me know how you want these data to be saved.

    And send me your admin login and ftp login.

    To send me details, please use our contact form: https://premium.wpmudev.org/contact/

    Select: I have a different question
    Subject: Attn-Ash (this ensures that it will be assigned to me)
    Details:
    1. Send all requested details
    2. Send a link of this thread so that I can track
    3. Send any other relevant link

    I will be happy to take a look :slight_smile:

    Cheers
    Ash

  • Ash
    • WordPress Hacker

    Hello @shannon

    Please add the following code in your theme's footer.php after wp_footer()

    <style>
    .frm_submit{display: none !important;}
    </style>
    <script type="text/javascript">
    jQuery(function($) {
      $('.mp_button_addcart').on('click', function() {
        $('.frm_submit input[type="submit"]').click();
      });
    });
    </script>

    Hope it helps :slight_smile: Please feel free to ask more question if you have.

    Cheers
    Ash

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.