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.

Please note this is a very limited example and will likely need to be modified to work correctly with actual widgets in a production environment. A developer with experience in Javascript would likely be required to modify the code to fit your exact use case.

Code to load on every page of a 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:

Please let us know if you have any questions. 

Sincerely,
The PayWhirl Team

Did this answer your question?