Woocommerce – How to populate custom select field with stored values on checkout page?

I just had a similar problem and solved it with a combination of PHP and jQuery.

If $stored_value is what you have pulled from the DB and #billing_postcode is the id of the select-tag:

<?php if ( !empty( $stored_value ) ) { ?>
<script type="text/javascript">
    jQuery(document).ready(function($) {
        $("select#billing_postcode").val( "<?php echo $stored_value; ?>" );
    });
</script>
<?php } ?>

I use this inside a function that I apply to the “woocommerce_checkout_fields” filter.

Update 1:
After a little bit more research I found out that I can also just do this:

<?php if ( !empty( $stored_value ) ) {
$fields['billing']['billing_postcode']['default'] = $stored_value;
} ?>

Update 2:

In functions.php of my theme, I put it in like this:

<?php
// Hook in
add_filter( 'woocommerce_checkout_fields' , 'jsm_override_checkout_fields' );

function jsm_override_checkout_fields( $fields ) {

    $stored_value = "something pulled from the DB";

    if ( !empty( $stored_value ) ) {
    $fields['billing']['billing_postcode']['default'] = $stored_value;
    }

    return $fields;
} ?>