Defult option selected in custom radio buttons

Hi guys, how do I make one of the these custom radio buttons checked by default?

<billing section="bottom">
        <fieldset class="snipcart-form__set">
            <div class="snipcart-form__field">

                <h1 class="snipcart-cart-summary__title snipcart__font--subtitle">Delivery or Collection</h1>

                <hr class="snipcart-form__separator" />
                <snipcart-radio name="deliveryType" value="DeliveryOrder">
                    I want my order to be deliverd.
                <br />
                <snipcart-radio name="deliveryType" value="CollectionOrder">
                    I will collect my order.


Also I was wondering if instead of adding these custom radio buttons to the billing step. Could I add them to the shipping step?

When someone changes which radio button they select I want to force snipcart to call my shipping webhook again so that I can refresh the shipping options that I display to the customer.

Is it possible to do this?

Hey @Ayo

Set initial value of custom field
Custom fields get their state from the global store in cart.customFields. This mean you can set a value for your custom fields as soon as Snipcart is ready. Here is a working example: Select default checkbox/radio field - CodeSandbox

Refetch shipping rates on option change
You could try adding these radio fields to the shipping step and adding an event listener to each fields and use this SDK method. JavaScript SDK API – Snipcart Documentation
A very basic approach could look like this:

<snipcart-radio @change.native="Snipcart.api.cart.fetchShippingRates"></snipcart-radio>
1 Like