Skip to content

Instantly share code, notes, and snippets.

@kreamweb
Created November 6, 2017 09:01
Show Gist options
  • Save kreamweb/01de15850e11970f4964a9a85e95e4fd to your computer and use it in GitHub Desktop.
Save kreamweb/01de15850e11970f4964a9a85e95e4fd to your computer and use it in GitHub Desktop.
if points inserted ad more tha max
<?php
if ( defined( 'YITH_YWPAR_PREMIUM' ) ) {
function ywpar_print_my_inline_script() {
?>
<script type="text/javascript" charset="utf-8">
jQuery(document).find('form.ywpar_apply_discounts').on('submit', function (e) {
var max = jQuery('input[name="ywpar_points_max"]').val(),
input_t = jQuery('#ywpar-points-max').val();
if (parseInt(max) < parseInt(input_t)) {
alert('your message');
return false;
} else {
return true;
}
});
</script>
<?php
endif;
}
add_action( 'wp_footer', 'ywpar_print_my_inline_script', 99 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment