Skip to main content
All CollectionsMulti-Platform Subscription App (Not for Shopify)Configuring PayWhirl Settings For Your Business
How to use custom scripts to limit the max quantity of plans on payment widgets
How to use custom scripts to limit the max quantity of plans on payment widgets

You can use the custom scripts integration to modify your widget(s) using javascript and jQuery before they are shown to your customers

Ryan P. avatar
Written by Ryan P.
Updated over 3 years ago

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:

Related Articles:

Please let us know if you have any questions. 

Sincerely,
The PayWhirl Team

Did this answer your question?