Add multiple products to the basket by SKU
Multiple products can be added to a visitor’s basket in a single request by specifying SKU codes and quantities.
This is useful when you want to add a predefined set of products from one button click, without requiring the visitor to add each product individually.
This method supports SKU, quantity and optional per-item comments only. It does not support variations, product choices or product extras.
How the feature works:
- The request is sent to the standard basket endpoint
/checkout/basket - The feature is triggered using the POST parameter
add_multiple_items - Each product is specified using its SKU and quantity
- The maximum recommended number of products per request is 50
Creating the form
Creating the form
Set the form action to:
/checkout/basket
Include the add_multiple_items parameter either as a hidden input:
<input type="hidden" name="add_multiple_items">
Or as the name of the submit button:
<button type="submit" name="add_multiple_items">Add to basket</button>
Specify SKUs and quantities using the sku parameter:
<input type="hidden" name="sku[TEST/123]" value="7">
<input type="hidden" name="sku[ABC/456]" value="2">
In this example:
TEST/123andABC/456are SKU codes- The value represents the quantity to add
Adding comments per item
Adding comments per item
You can attach a comment to each SKU using the comments parameter.
The SKU must match the SKU used in the sku parameter.
<input type="hidden" name="comments[TEST/123]" value="Custom engraving text">
Each comment is applied to the corresponding basket item.
Using AJAX
Using AJAX
When submitting the form using AJAX, the response will return:
successerrors(only present ifsuccessis false)
If some products fail, the system will continue processing the remaining SKUs and return details of failed products.
This allows the theme to display custom success or error messaging.
Using standard form submission
Using standard form submission
When using normal form submission with redirection, the following POST parameters are available after processing:
redirect_pathredirect_message
These parameters are always returned, even if errors occur.
With standard redirection, only a general success message can be displayed. Detailed per-SKU error feedback is only available when using AJAX.
Error handling behaviour
Error handling behaviour
The system continues processing even if some SKUs fail.
Errors can occur for reasons such as:
- Invalid SKU
- Invalid quantity
- SKU not found
- Out of stock item
- Unexpected processing error
When using AJAX, failed SKUs are returned in the errors array.
When using standard redirection, only a general result message is available.
Limitations
Limitations
- Only SKU and quantity are supported
- Variations, choices and extras are not supported
- Product IDs are not supported
- A maximum of approximately 50 products per request is recommended
If you need to support variations, choices or extras, use the standard add-to-basket URL method instead.