CF7 Ajax isn’t working when called inside WooCommerce “woocommerce_before_add_to_cart_button” hook

Question

I am trying to place a CF7 Contact form on the product details page. I have used the WooCommerce hook woocommerce_before_add_to_cart_button for that.

add_action( 'woocommerce_before_add_to_cart_button', 'custom_before_add_to_cart_btn' );

function custom_before_add_to_cart_btn() {
    echo do_shortcode( '[contact-form-7 404 "Not Found"]' );
}

But on submitting the form, the page is actually getting refreshed. The Ajax is no longer working. I got no errors in the Console, so i don’t think it’s a JS issue.

It is a fresh WooCommerce Storefront Installation, no other plug-ins or anything. Do you guys have any idea how this is happening and how can I get around this ?

This is the screencast of what’s exactly happening : Screencast

0
Rahul K 3 months 0 Answers 11 views 0

Leave an answer