Setting a Maximum Product Quantity in ShopSite

Forum Forums Tutorials Setting a Maximum Product Quantity in ShopSite

This topic contains 0 replies, has 1 voice, and was last updated by  Anonymous 8 years, 2 months ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #48753

    Anonymous
    Participant

    There may be several instances where you would like to set a maximum quantity per product per order. For example, you may have a specially priced item that you are offering as a promotion, but you do not want to allow more than one per order.

    If you are using ShopSite Pro, you can enforce this by using the JavaScript CheckIt function located under Commerce Setup -> Order System -> Shopping Cart. Here is some sample code you can use to enforce a maximum quantity of one for a particular item:

     

    ns_count = 0; 
     
     for(ns=0; ns<ss_sku.length; ns++){ 
        if(ss_sku[ns]=='XXX'){ 
             ns_count+= ss_quantity[ns]; 
        } 
     } 
     
     if (button == "8") { 
       if(ns_count > 1){ 
         alert("You may only order one of product YYY, please adjust your quantity accordingly"); 
         
         return false; 
       } 
     }

     

    Replace XXX with the SKU of the product and YYY with the product name. If you want to set a maximum quantity greater than one, simply replace the value of “1″ in the above code with the desired maximum value.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.