WooCommerce checkout integration with list full State name
-
I am trying to get my MailChimp integration set up with my WooCommerce check out. My list requires the State, which is default on the checkout, but it is abbreviated and I need it to be the full name. I have this code to pull the state info:
add_filter( ‘mc4wp_integration_woocommerce_data’, function( $data ) {
// Grab MailChimp field values from the current request
$data[‘STATE’] = sanitize_text_field( $_POST[‘billing_state’] );// Return the fields so the plugin knows to send them to MailChimp
return $data;
});and this to convert the state abbreviation to full name:
$us_state_abbrevs_names = array(
‘AL’=>’ALABAMA’,
‘AK’=>’ALASKA’,
‘AS’=>’AMERICAN SAMOA’,
‘AZ’=>’ARIZONA’,
‘AR’=>’ARKANSAS’,
);but am not sure how to combine the two so that the field being returned to mailchimp is the full state name. Your help would be greatly appreciated. Thanks in advance.
The page I need help with: [log in to see the link]
- The topic ‘WooCommerce checkout integration with list full State name’ is closed to new replies.