June 7, 2017
Request price form when price is empty
Author:
Jos
Description:
The PHP file is available in the URL
PHP variation
Instead of showing the button with echo it can be done with this:
$html .= ' Request Price'; $html .= ''; $html .= do_shortcode('[gravityform id="1" title="true" description="true"]'); $html .= ''; return $html;
The jQuery handles the onClick event to open and close the form
Kind:
jQuery, PHP, plugin, woocommerce
Javascript:
// OPEN AND CLOSE PRICE ENQUIRY FORM
jQuery('#trigger_cf').on('click', function(){
if ( jQuery(this).text() == 'Request Price' ) {
jQuery('#product_inq').slideDown({
'height': 'toggle'
}, 300);
jQuery("#trigger_cf").html('Close');
} else {
jQuery('#product_inq').animate({
'height': 'toggle'
}, 300);
jQuery("#trigger_cf").html('Request Price');
}
});
PHP:
See the plugin (URL)