Hi @cambuff,
We have an option to enable the full state name display in the premium version of the plugin. You can use the code snippet below to have full state names with the basic version. Copy the code to your active theme’s functions.php
add_filter('wf_pklist_alter_shipping_address','wf_pklist_alter_shipping_address_fn',10,3);
function wf_pklist_alter_shipping_address_fn($address,$template_type,$order)
{
$order_id = (WC()->version < '2.7.0') ? $order->id : $order->get_id();
$countries = new WC_Countries;
$shipping_country = get_post_meta($order_id, '_shipping_country', true);
$shipping_state = get_post_meta($order_id, '_shipping_state', true);
$shipping_state_full = ( $shipping_country && $shipping_state && isset($countries->states[$shipping_country][$shipping_state]) ) ? $countries->states[$shipping_country][$shipping_state] : $shipping_state;
$address['state']=$shipping_state_full;
unset($countries);
return $address;
}
add_filter('wf_pklist_alter_billing_address','wf_pklist_alter_billing_address_fn',10,3);
function wf_pklist_alter_billing_address_fn($address,$template_type,$order)
{
$order_id = (WC()->version < '2.7.0') ? $order->id : $order->get_id();
$countries = new WC_Countries;
$billing_country = get_post_meta($order_id, '_billing_country', true);
$billing_state = get_post_meta($order_id, '_billing_state', true);
$billing_state_full = ( $billing_country && $billing_state && isset($countries->states[$billing_country][$billing_state]) ) ? $countries->states[$billing_country][$billing_state] : $billing_state;
$address['state']=$billing_state_full;
unset($countries);
return $address;
}
add_filter('wf_pklist_alter_shipping_from_address','wf_pklist_alter_shipping_from_address_fn',10,3);
function wf_pklist_alter_shipping_from_address_fn($address,$template_type,$order)
{
if(class_exists('Wf_Woocommerce_Packing_List'))
{
$the_options=Wf_Woocommerce_Packing_List::get_settings();
$country_selected=$the_options['wf_country'];
$country_arr=explode(":",$country_selected);
$country=isset($country_arr[0]) ? $country_arr[0] : '';
$state=isset($country_arr[1]) ? $country_arr[1] : '';
if($country!="" && $state!="")
{
$order_id = (WC()->version < '2.7.0') ? $order->id : $order->get_id();
$countries = new WC_Countries;
$state_full = ( isset($countries->states[$country][$state]) ) ? $countries->states[$country][$state] : $state;
$address['state']=$state_full;
unset($countries);
}
}
return $address;
}