Custom code not working for getting the title

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?

Hey @ShubhamSach100,

Your issue is not caused by our theme but by the custom code you’re using. Please note that we do not provide support for custom codes and 3rd party plugins.

Please consult with a developer to fix the custom code you’re using.

Thanks for understanding. Take care!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.