Hi everyone. On the website I am making, I would like to place a contact form for each product. I use Fluent Forms and Code Snippets plugins for this. The form works in such a way that it opens when the button is pressed, but only if the text of the button is the same as in the code (you can see it in the code screenshot from Code Snippets). For this reason, when I translate the page to another language using the TranslatePress plugin, the form does not expand because the button text is different (because it has been translated). Can it be resolved somehow? Maybe something like adding two conditions to the button name in the code?
​
​
https://preview.redd.it/4ol55j2dfboa1.png?width=1104&format=png&auto=webp&v=enabled&s=475138a7cf04880f2fd3b4845bb79761e6a61512
https://preview.redd.it/xas57k2dfboa1.png?width=932&format=png&auto=webp&v=enabled&s=b0b4b8b19ee071f592c1dc3166ac29c4a615ed4f
https://preview.redd.it/fkodnm2dfboa1.png?width=818&format=png&auto=webp&v=enabled&s=d6c2dbe274173e6523c1c6a743c6a0aea6419d19
// Adds a enquiry form on your Woocommerce Single product page
add_action( ‘woocommerce_single_product_summary’, ‘enquiry_form’, 30 );
function enquiry_form() {
echo ‘<button type=”submit” id=”trigger_cf” class=”button alt”>SEND US YOUR ENQUIRY</button>’;
echo ‘<div id=”product_inq” style=”display:none”>’;
echo do_shortcode(‘[fluentform id=”3″]’);
echo ‘</div>’;
}
add_action( ‘woocommerce_single_product_summary’, ‘enquiry_form_1’, 40);
function enquiry_form_1() {
?>
<script type=”text/javascript”>
jQuery(‘#trigger_cf’).on(‘click’, function(){
if ( jQuery(this).text() == ‘SEND US YOUR ENQUIRY’ ) {
jQuery(‘#product_inq’).css(“display”,”block”);
jQuery(“#trigger_cf”).html(‘CLOSE’);
} else {
jQuery(‘#product_inq’).hide();
jQuery(“#trigger_cf”).html(‘SEND US YOUR ENQUIRY’);
}
});
</script>
<?php
}