Cart custom fields

Custom fields can be easily added into any forms of the checkout flow. To add a custom field, you'll need to override the default templates. For example, if you want to add a checkbox to the billing section of the checkout to collect whether or not the customer wants to subscribe to your mailing list, you could do the following:

<billing section="bottom">
    <fieldset class="snipcart-form__set">
        <div class="snipcart-form__field">
            <div class="snipcart-form__field-checkbox">
                <snipcart-checkbox name="subscribeToNewsletter"></snipcart-checkbox>
                <snipcart-label class="snipcart__font--tiny snipcart-form__label--checkbox" for="subscribeToNewsletter">
                    Subscribe to newsletter
                </snipcart-label>
            </div>
        </div>
    </fieldset>
</billing>

This should look like this:

cart-custom-fields

You can also add dropdowns:

<billing section="bottom">
    <fieldset class="snipcart-form__set">
        <div class="snipcart-form__field">
            <snipcart-label class="snipcart__font--tiny" for="customerType">
                Customer type
            </snipcart-label>
            <snipcart-select name="customerType" class="nipcart-form__select  snipcart__font--secondary snipcart__font--bold">
                <option value="Corporate">Corporate</option>
                <option value="Personal">Personal</option>
                <option value="NonProfit">Non-profit</option>
            </snipcart-select>
        </div>
    </fieldset>
</billing>

And finally, textboxes:

<billing section="bottom">
    <fieldset class="snipcart-form__set">
        <div class="snipcart-form__field">
            <snipcart-label class="snipcart__font--tiny" for="vatNumber">
                VAT Number
            </snipcart-label>
            <snipcart-input name="vatNumber"></snipcart-input>
        </div>
    </fieldset>
</billing>

Custom fields will automatically be added to the cart customFields object. You'll see them in the dashboard as part of the order details.