• Resolved gloomya

    (@gloomya)


    Hi, I’m trying to use contact form in my template using do_shortcode and popup (Request availability button on a page). But I’ve noticed that form generated only inputs without <form> tag as usual so it failed to submit.

    That’s how I’m implementing it in functions.php

    function wc_shop_popup() {
    	$reqform = '[contact-form-7 id="987" title="Request availability"]';
        echo '<a class="button button_full_width button_left req_button popup-link" href="#popup-availability" rel="lightbox" data-type="inline"><span class="button_icon"><i class="icon-layout"></i></span><span class="button_label">Request Availability</span></a>
    	<div id="popup-availability" class="popup-content mfp-hide"><div class="popup-inner" style="padding:20px;">'.do_shortcode($reqform).'</div></div>';
    }
    add_action( 'woocommerce_after_add_to_cart_button', 'wc_shop_popup' );

    Any suggestions?

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    Because this tag doesn’t have a closing counterpart (</form>) and that makes the whole HTML structure on the page invalid.

    <form class="cart" action="https://wholesalehandsanitizer.ca/product/bioam-30ml-1oz-travel-hand-sanitizer-wholesale/" method="post" enctype='multipart/form-data'>

    Thread Starter gloomya

    (@gloomya)

    It does. But I guess the problem is the form is generated inside of this form that’s why it failed to work. Thank you for pointing on that.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Using do_shortcode() with contact form 7 and tag is missing’ is closed to new replies.