Hi, I was trying to add contact form inside wordpress single product page but its just showing php the_title
In subject i want to get the value as the title of the page?
i am using this code.
add_action( 'woocommerce_single_product_summary' , 'bbloomer_woocommerce_cf7_single_product' , 30 );
function bbloomer_woocommerce_cf7_single_product() {
echo ‘Product Inquiry’;
echo ‘
echo do_shortcode(’[contact-form-7 id=“187” title=“Contact form 2”]’);
echo ‘
wc_enqueue_js( "
$(’#trigger_cf’).on(‘click’, function(){
if ( $(this).text() == ‘Product Inquiry’ ) {
$(’#product_inq’).css(‘display’,‘block’);
$(‘input[name=“your-subject”]’).val(’<?php the_title(); ?>’);
$(’#trigger_cf’).html(‘Close’);
} else {
$(’#product_inq’).hide();
$(’#trigger_cf’).html(‘Product Inquiry’);
}
});
" );
}
Also is it possible to make that field uneditable?
