Is posible to validate the Request a Quote button if there is Dinamics Rules in the cart see image atached as example , I dont want customers to Request a Quote if Dinamic Rules are valid for thar minimun amount for the requested products.
Quote Button Validation
Closed
Comments
Hello Eduardo,
There's no default feature for that, but I tried writing a code snippet for it.
I believe you can add this PHP code snippet to your site:
add_action('wp_head', function(){
?>
<script>
jQuery(document).ready(function(){
jQuery('#b2bking_request_custom_quote_button').click(function(e) {
// Check if any element with class 'woocommerce-error' exists
if (jQuery('.woocommerce-error').length > 0) {
e.preventDefault();
e.stopPropagation();
alert('Please resolve cart errors before requesting a quote.');
}
});
});
</script>
<?php
});A PHP snippet can be added to functions.php, or by following our guide here: https://b2bkingplugin.com/docs/how-to-add-a-snippet-php-or-js/
Clicking the button should then show an error as follows:

The code may need some small adjustments depending on your theme though. Let me know if that code works as needed for you,
Kind regards,
Stefan
1