Adding Multiple Items to the Shopping Cart

You can add more than one item to the shopping cart in one request. First set the value of the buyid attribute to “multi.” Next, add the item IDs, and item quantities as values for the multi attribute.

Adding Multiple Items to the Cart with a URL

The sample URL below from account number 123456, adds one item (ID=51) with size and color options; and one of another item (ID=52) with different size and color options.

          /app/site/backend/additemtocart.nl?c=123456&buyid=multi&multi=51,1,custcolsize|1||
custcolcolor|1;52,2,custcolsize|2||custcolcolor|2 

        

You can use item ID and quantity, or item ID, quantity and options in a URL that adds multiple items to the shopping cart. Note the example of item options specified in the URL:

          custcolsize|1||custcolcolor|1; 

        
Note:

The vertical bar (|) separates option ID (custcolsize) from option value (1). The double vertical bar (||) separates option ID/value pairs from one another.

Adding Multiple Items to the Cart Using HTML

When you operate an external catalog site, use HTML to add multiple items to the shopping cart. The sample code below adds one each of item IDs 206, 207, 205 and 208 to the shopping cart.

For more information on internal IDs, see How do I find a record's internal ID?

Sample code snippet for adding multiple items to the shopping cart:

          <!-- START ITEM TEMPLATE -->
<td>
<!-- START MULTI ITEM ADD CODE -->
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<form method='post' action='http://www.wolfeelctronics.com/app/site/backend/additemtocart.nl'>
<tr>
<td>
<p align="left"><input class='bgbutton' type="submit" value="Enter Store"></p>
<input type='hidden' name='c' value='123456'>
<input type=hidden name='qtyadd' id='qtyadd' value='1'>
<input type=hidden name='buyid' id='buyid' value='multi'>
<input type=hidden name='multi' id='multi' value='206,1;207,1;205,1;208,1'>
</td>
</tr>
</table>
</form>
<!-- END MULTI ITEM ADD CODE -->
</td>
<!-- END ITEM TEMPLATE --> 

        
Note:

The code sample above also functions with the NetSuite shopping domain. Replace the URL in the <form> tag. For example: <form method='post' action='http://shop.netsuite.com/app/site/backend/additemtocart.nl'>

Related Topics

URL Parameters for Adding Items to the Cart
Website URL Parameters

General Notices