Skip to content

Instantly share code, notes, and snippets.

@harisrozak
Created June 20, 2016 06:55
Show Gist options
  • Save harisrozak/9b5250ce131071662e0b6385bf98c23a to your computer and use it in GitHub Desktop.
Save harisrozak/9b5250ce131071662e0b6385bf98c23a to your computer and use it in GitHub Desktop.
<?php
// set some checkout fields to empty
add_filter('woocommerce_checkout_get_value','woo_ongkir_checkout_get_value', 10, 2);
function woo_ongkir_checkout_get_value($default, $field)
{
$empty_fields = array(
'billing_postcode',
'billing_state',
'billing_city',
'billing_district',
'shipping_postcode',
'shipping_state',
'shipping_city',
'shipping_district'
);
if(in_array($field, $empty_fields)) {
return "";
}
else {
return $default;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment