Hello,
You can add the following code to the functions.php file:
if ( ! function_exists( 'yith_ywraq_show_button_based_on_qty' ) ) {
add_action( 'wp_footer', 'yith_ywraq_show_button_based_on_qty' );
function yith_ywraq_show_button_based_on_qty() {
?>
<script type="text/javascript">
jQuery( '.product .entry-summary .quantity .qty.text' ).on( 'change', function ( e ) {
var qty = 5;
var $button = jQuery( '.product .entry-summary .yith-ywraq-add-to-quote' );
if ( parseInt( jQuery( this ).val() ) >= qty ) {
$button.css( 'display', 'block' );
} else {
$button.css( 'display', 'none' );
}
} ).trigger( 'change' );
</script>
<?php
}
}
You only have to change the number 5 on this line:
var qty = 5;
The number you’ll set will act as the threshold for starting to show the “add to quote” button.
For example, without modifying the previous code, the “add to quote” button is hidden until you select 5 or more.
Thread Starter
thimy
(@thimy)
Hi @yithemes
Firstable thank you for your reply, i appreciate,
but this code isn’t work for me, i don’t understand why the add_action begin by ‘wp_footer’ ?
Is it a function in your plugin and did you test it because there is no change for me.
Then, i search a way to deactivate the button (keeping the button visible) not by hiding it.
If there is no other choice, i take the hide with the display none css but with a functional code if possible 🙂
Thanks again.