Add multiple products to the basket at a time
Guide to implementing an 'add more to cart' feature, for example on landing pages or wholesale pages.
You can let customers add multiple products to the cart at once. This is done by using an array in the form instead of the normal single product format.
Code example from a landing page
<form action="" method="post"> <{section name="i" loop=$products}> <h3><{$products[i]->getName()|escape}></h3> <input type="hidden" name="add_to_basket[<{$smarty.section.i.index}>][product_id]" value="<{$products[i]->getProductId()}>"/> <input type="number" name="add_to_basket[<{$smarty.section.i.index}>][amount]" value="0" min="0"/> <{/section}> <input type="submit" value="Add to cart"/> </form>
The key is to use add_to_basket as an array with an index for each product. Each element should contain product_id and amount.
You can also add attribute_value_id for variants and comment for comments per product.
Do you need help? Contact us at support@shoporama.dk.