Shopping basket
The checkout/basket view hosts several forms relating to the different functions of the shopping basket page.
1. A form to update the quantities of items in the basket
2. A form to apply a voucher/gift card code
3. A form to submit to the checkout/address page
Updating the items in the basket
The items in the basket should be surrounded with a form where the action attribute is set to /checkout/basket.
Each item in the basket should have a text field where the name attribute is set to quantity[x] where x is the id of the item in the basket and the value is set to the item's current quantity.
<input type="text" name="quantity[{{ item.id }}]" value="{{ item.quantity }}">
A button of type="submit" is used to submit the amended quantity.
Applying a voucher code
To apply a voucher code, a text input of name="voucher_code" should be surrounded with a form where the action attribute is set to /checkout/basket, and a button of type="submit" to submit the form.
<form action="/checkout/basket" method="post"> <input name="voucher_code" placeholder="enter your voucher code"> <button type="submit">Apply</button> </form>
Proceeding to checkout
To proceed to checkout, the user must select a delivery rate (which is a platform requirement).
The form's action attribute should either be set to /checkout/address or /checkout/login depending on the checkout path you want the website visitor to take, e.g.
<form action="/checkout/address" method="post"> <!-- Delivery Selection Here --> <button type="submit">Checkout</button> <button type="submit" name="paypal_express" value="1">Checkout With PayPal</button> </form>
A button of type="submit" submits the checkout form but you can also include a button where the name attribute is paypal_express and value is 1 to submit the checkout process to PayPal Express.
Instructions on how to correctly render a section allowing the user to choose their delivery rate can be found here.