You can use the custom scripts integration to modify your widget(s) using javascript and jQuery before they are shown to your customers. In this example we will show you how you can set a max quantity on your widgets so customers can only purchase a max of 5 on each plan:

Code to load on every page of widget in custom scripts app:

<script>
$(function(){
      var max_qty = 5;
      var plan_position = 0;

      $("#qty_"+plan_position).change(function(){
            if($(this).val() > max_qty){
                  $(this).val(max_qty);
            }
      });
});
</script>


Example of code in Custom Scripts App:

Did this answer your question?